Struct oysterpack_uid::ulid::ULID
source · pub struct ULID(_);
Expand description
Provides the core ULID functionality.
let id = ULID::generate();
// Get the ULID creation timestamp
let datetime = id.datetime();
// ULID provides a bunch of useful conversion
let id: u128 = ULID::generate().into();
let id = ULID::from(id);
let (id_1, id_2): (u64, u64) = ULID::generate().into();
let id3: ULID = "01CVG2MP5HJ45SRJTRRHRQ3RJ0".parse().unwrap();
// ULIDs are passed by value, i.e., copied
fn foo(id: ULID) {
println!("{}", id);
}
foo(id3);
foo(id3);
Implementations§
Trait Implementations§
source§impl<'de> Deserialize<'de> for ULID
impl<'de> Deserialize<'de> for ULID
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for ULID
impl Ord for ULID
source§impl PartialOrd<ULID> for ULID
impl PartialOrd<ULID> for ULID
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more