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.
Trait Implementations§
source§impl<T: TypedUuidKind> Clone for TypedUuid<T>
impl<T: TypedUuidKind> Clone for TypedUuid<T>
source§impl<T: TypedUuidKind> Debug for TypedUuid<T>
impl<T: TypedUuidKind> Debug for TypedUuid<T>
source§impl<T: TypedUuidKind> Default for TypedUuid<T>
impl<T: TypedUuidKind> Default for TypedUuid<T>
source§impl<'de, T: TypedUuidKind> Deserialize<'de> for TypedUuid<T>
impl<'de, T: TypedUuidKind> Deserialize<'de> for TypedUuid<T>
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<T: TypedUuidKind> Display for TypedUuid<T>
impl<T: TypedUuidKind> Display for TypedUuid<T>
source§impl<T: TypedUuidKind> FromStr for TypedUuid<T>
impl<T: TypedUuidKind> FromStr for TypedUuid<T>
source§impl<T: TypedUuidKind> GenericUuid for TypedUuid<T>
impl<T: TypedUuidKind> GenericUuid for TypedUuid<T>
source§impl<T: TypedUuidKind> Hash for TypedUuid<T>
impl<T: TypedUuidKind> Hash for TypedUuid<T>
source§impl<T> JsonSchema for TypedUuid<T>where
T: TypedUuidKind + JsonSchema,
Available on crate feature schemars08
only.
impl<T> JsonSchema for TypedUuid<T>where
T: TypedUuidKind + JsonSchema,
schemars08
only.Implements JsonSchema
for TypedUuid<T>
, if T
implements JsonSchema
.
schema_name
is set to"TypedUuidFor"
, concatenated by the schema name ofT
.schema_id
is set toformat!("newtype_uuid::TypedUuid<{}>", T::schema_id())
.json_schema
is the same as the one forUuid
.
source§fn schema_name() -> String
fn schema_name() -> String
source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read moresource§impl<T: TypedUuidKind> Ord for TypedUuid<T>
impl<T: TypedUuidKind> Ord for TypedUuid<T>
source§impl<T: TypedUuidKind> PartialEq for TypedUuid<T>
impl<T: TypedUuidKind> PartialEq for TypedUuid<T>
source§impl<T: TypedUuidKind> PartialOrd for TypedUuid<T>
impl<T: TypedUuidKind> PartialOrd for TypedUuid<T>
source§impl<T: TypedUuidKind> Serialize for TypedUuid<T>
impl<T: TypedUuidKind> Serialize for TypedUuid<T>
impl<T: TypedUuidKind> Copy for TypedUuid<T>
impl<T: TypedUuidKind> Eq for TypedUuid<T>
Auto Trait Implementations§
impl<T> Freeze for TypedUuid<T>
impl<T> RefUnwindSafe for TypedUuid<T>where
T: RefUnwindSafe,
impl<T> Send for TypedUuid<T>
impl<T> Sync for TypedUuid<T>
impl<T> Unpin for TypedUuid<T>where
T: Unpin,
impl<T> UnwindSafe for TypedUuid<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)