pub struct Ulid(/* private fields */);Expand description
A 128-bit ULID with exact 16-byte storage and canonical uppercase text.
Use Self::generate_prand for synchronous issuance on the IC or a native host.
Construct supplied identifiers with Self::from_bytes, Self::from_u128 or parsing.
Implementations§
Source§impl Ulid
impl Ulid
Sourcepub fn generate_prand() -> Self
pub fn generate_prand() -> Self
Issue synchronously from the current thread’s predictable stream.
§Panics
Panics on suffix exhaustion or if the native OS cannot seed the thread.
Sourcepub async fn generator() -> Result<SeededUlidGenerator, UlidEntropyError>
pub async fn generator() -> Result<SeededUlidGenerator, UlidEntropyError>
Start an owned generator with fresh entropy from the IC or native OS. Later issuance is synchronous.
§Errors
Returns the entropy request or framing error.
Sourcepub fn generator_prand() -> SeededUlidGenerator
pub fn generator_prand() -> SeededUlidGenerator
Start an independent predictable stream under the current canister or native thread identity.
§Panics
Panics on stream counter exhaustion or if the native OS cannot seed the thread.
Source§impl Ulid
impl Ulid
Sourcepub const fn from_bytes(bytes: [u8; 16]) -> Self
pub const fn from_bytes(bytes: [u8; 16]) -> Self
Construct from exactly 16 bytes, timestamp prefix first.
Sourcepub const fn from_u128(value: u128) -> Self
pub const fn from_u128(value: u128) -> Self
Construct from the unsigned big-endian integer representation.