pub struct Ulid { /* private fields */ }Expand description
A 128-bit lexicographically sortable ULID (48-bit ms timestamp | 80-bit entropy).
Implementations§
Source§impl Ulid
Core constructors and zero-allocation Crockford Base32 codecs for Ulid.
impl Ulid
Core constructors and zero-allocation Crockford Base32 codecs for Ulid.
Sourcepub const fn from_parts(timestamp_ms: u64, random_80: u128) -> Self
pub const fn from_parts(timestamp_ms: u64, random_80: u128) -> Self
Sourcepub const fn timestamp_ms(self) -> u64
pub const fn timestamp_ms(self) -> u64
Returns the 48-bit Unix millisecond timestamp component.
§Returns
u64- Unix timestamp in milliseconds.
Sourcepub const fn from_bytes(bytes: [u8; 16]) -> Self
pub const fn from_bytes(bytes: [u8; 16]) -> Self
Sourcepub const fn encode_stack(self) -> [u8; 26]
pub const fn encode_stack(self) -> [u8; 26]
Encodes the ULID into a 26-byte ASCII Crockford Base32 stack array with zero heap allocation.
§Returns
[u8; ULID_STR_LEN]- Canonical uppercase 26-byte Crockford Base32 array.
Trait Implementations§
impl Copy for Ulid
impl Eq for Ulid
Source§impl Ord for Ulid
impl Ord for Ulid
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Ulid
impl PartialOrd for Ulid
impl StructuralPartialEq for Ulid
Auto Trait Implementations§
impl Forget for Ulid
impl Freeze for Ulid
impl Move for Ulid
impl RefUnwindSafe for Ulid
impl Send for Ulid
impl Sync for Ulid
impl Unpin for Ulid
impl UnsafeUnpin for Ulid
impl UnwindSafe for Ulid
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
Mutably borrows from an owned value. Read more