new_ulid
pub fn new_ulid() stringPurpose
new_ulid returns a 26-char Crockford ULID for the current wall clock. Throws on failure.
Parameters
none
Returns
string — result string
API
#idSortable identifiers for messages / files / sessions. ULID (Crockford base32, 26 chars): 48-bit ms timestamp + 80-bit random. UUIDv7 (RFC 9562): 48-bit unix ms + version/variant + 62-bit random, canonical 8-4-4-4-12 lowercase hex. Monotonic ULID: same-millisecond ids increment the random field so lexicographic order matches issue order on one process. Xu forbids package mutable globals — keep a Monotonic generator per producer.
new_ulidpub fn new_ulid() stringnew_ulid returns a 26-char Crockford ULID for the current wall clock. Throws on failure.
none
string — result string
struct Monotonicpub struct Monotonic {
}Monotonic keeps the last ULID so same-ms ids stay ordered.
none
new_monotonicpub fn new_monotonic() MonotonicConstruct monotonic.
none
Monotonic — a value of this type
(&mut Monotonic) nextpub fn (m &mut Monotonic) next() stringnext returns a ULID ≥ the previous one from this generator (process-local). Throws on failure.
m &mut Monotonicstring — result string
ulid_time_mspub fn ulid_time_ms(s string) intulid_time_ms extracts the 48-bit timestamp from a 26-char ULID. Returns -1 on bad input.
s stringint — a value of this type
new_uuid_v7pub fn new_uuid_v7() stringnew_uuid_v7 returns a canonical UUIDv7 (8-4-4-4-12 lowercase hex). Throws on failure.
none
string — result string
uuid_v7_time_mspub fn uuid_v7_time_ms(s string) intuuid_v7_time_ms extracts unix ms from a UUIDv7 string. -1 if invalid.
s stringint — a value of this type