pub trait UlidExt: Sized {
// Required methods
fn from_datetime_with_rng<R: Rng + ?Sized>(
datetime: DateTime<Utc>,
rng: &mut R,
) -> Self;
fn datetime_utc(&self) -> DateTime<Utc>;
}Expand description
Extension trait on Ulid to build and inspect ULIDs using chrono
timestamps and an injected RNG.
Required Methods§
Sourcefn from_datetime_with_rng<R: Rng + ?Sized>(
datetime: DateTime<Utc>,
rng: &mut R,
) -> Self
fn from_datetime_with_rng<R: Rng + ?Sized>( datetime: DateTime<Utc>, rng: &mut R, ) -> Self
Generate a Ulid for the given timestamp, sourcing its randomness
from rng.
This reproduces the exact bit layout of ulid’s own
Ulid::from_datetime_with_source (48 timestamp bits, then 80 random
bits drawn as a u16 followed by a u64).
Sourcefn datetime_utc(&self) -> DateTime<Utc>
fn datetime_utc(&self) -> DateTime<Utc>
The creation timestamp encoded in this Ulid, as a chrono datetime.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.