pub struct TypedUuid<T: TypedUuidKind> { /* private fields */ }
Expand description
A UUID with type-level information about what it’s used for.
For more, see the library documentation.
Implementations§
Source§impl<T: TypedUuidKind> TypedUuid<T>
impl<T: TypedUuidKind> TypedUuid<T>
Sourcepub const fn nil() -> Self
pub const fn nil() -> Self
The ‘nil UUID’ (all zeros).
The nil UUID is a special form of UUID that is specified to have all 128 bits set to zero.
§References
Sourcepub const fn max() -> Self
pub const fn max() -> Self
The ‘max UUID’ (all ones).
The max UUID is a special form of UUID that is specified to have all 128 bits set to one.
§References
Sourcepub const fn from_fields(d1: u32, d2: u16, d3: u16, d4: [u8; 8]) -> Self
pub const fn from_fields(d1: u32, d2: u16, d3: u16, d4: [u8; 8]) -> Self
Creates a UUID from four field values.
Sourcepub const fn from_fields_le(d1: u32, d2: u16, d3: u16, d4: [u8; 8]) -> Self
pub const fn from_fields_le(d1: u32, d2: u16, d3: u16, d4: [u8; 8]) -> Self
Creates a UUID from four field values in little-endian order.
The bytes in the d1
, d2
and d3
fields will be flipped to convert into big-endian
order. This is based on the endianness of the UUID, rather than the target environment so
bytes will be flipped on both big and little endian machines.
Sourcepub const fn from_u128_le(value: u128) -> Self
pub const fn from_u128_le(value: u128) -> Self
Creates a UUID from a 128bit value in little-endian order.
The entire value will be flipped to convert into big-endian order. This is based on the endianness of the UUID, rather than the target environment so bytes will be flipped on both big and little endian machines.
Sourcepub const fn from_u64_pair(d1: u64, d2: u64) -> Self
pub const fn from_u64_pair(d1: u64, d2: u64) -> Self
Creates a UUID from two 64bit values.
Sourcepub const fn from_bytes(bytes: Bytes) -> Self
pub const fn from_bytes(bytes: Bytes) -> Self
Creates a UUID using the supplied bytes.
Sourcepub const fn from_bytes_le(bytes: Bytes) -> Self
pub const fn from_bytes_le(bytes: Bytes) -> Self
Creates a UUID using the supplied bytes in little-endian order.
The individual fields encoded in the buffer will be flipped.
Sourcepub const fn get_version_num(&self) -> usize
pub const fn get_version_num(&self) -> usize
Returns the version number of the UUID.
This represents the algorithm used to generate the value.
This method is the future-proof alternative to Self::get_version
.
§References
Sourcepub fn get_version(&self) -> Option<Version>
pub fn get_version(&self) -> Option<Version>
Returns the version of the UUID.
This represents the algorithm used to generate the value.
If the version field doesn’t contain a recognized version then None
is returned. If you’re trying to read the version for a future extension
you can also use Uuid::get_version_num
to unconditionally return a
number. Future extensions may start to return Some
once they’re
standardized and supported.