#[repr(transparent)]pub struct Uuid(/* private fields */);
Expand description
Represents a Universally Unique IDentifier.
Implementations§
source§impl Uuid
impl Uuid
sourcepub const fn from_fields_v7(unix_ts_ms: u64, rand_a: u16, rand_b: u64) -> Self
pub const fn from_fields_v7(unix_ts_ms: u64, rand_a: u16, rand_b: u64) -> Self
Creates a UUID byte array from UUIDv7 field values.
sourcepub const fn encode(&self) -> FStr<36>
pub const fn encode(&self) -> FStr<36>
Returns the 8-4-4-4-12 hexadecimal string representation stored in a stack-allocated
string-like type that can be handled like String
through Deref<Target = str>
and
other common traits.
Examples
use uuid7::Uuid;
let x = "01809424-3e59-7c05-9219-566f82fff672".parse::<Uuid>()?;
let y = x.encode();
assert_eq!(y, "01809424-3e59-7c05-9219-566f82fff672");
assert_eq!(format!("{}", y), "01809424-3e59-7c05-9219-566f82fff672");
sourcepub const fn encode_hex(&self) -> FStr<32>
pub const fn encode_hex(&self) -> FStr<32>
Returns the 32-digit hexadecimal string representation without hyphens stored in a
stack-allocated string-like type that can be handled like String
through
Deref<Target = str>
and other common traits.
Examples
use uuid7::Uuid;
let x = "01809424-3e59-7c05-9219-566f82fff672".parse::<Uuid>()?;
let y = x.encode_hex();
assert_eq!(y, "018094243e597c059219566f82fff672");
assert_eq!(format!("{}", y), "018094243e597c059219566f82fff672");
sourcepub fn variant(&self) -> Variant
pub fn variant(&self) -> Variant
Reports the variant field value of the UUID or, if appropriate, Nil
or Max
.
For convenience, this function reports Variant::Nil
or Variant::Max
if self
represents the Nil or Max UUID, although the Nil and Max UUIDs are technically subsumed
under the variants 0b0
and 0b111
, respectively.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Uuid
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for Uuid
serde
only.source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
source§impl Ord for Uuid
impl Ord for Uuid
source§impl PartialEq<Uuid> for Uuid
impl PartialEq<Uuid> for Uuid
source§impl PartialOrd<Uuid> for Uuid
impl PartialOrd<Uuid> for Uuid
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more