Skip to main content

Crate atomic_snowflake

Crate atomic_snowflake 

Source
Expand description

atomic-snowflake

Zero-dependency lock-free monotonic 64-bit Snowflake ID, 128-bit ULID, and RFC 9562 UUIDv7 generators with zero-allocation stack codecs.

Structs§

SnowflakeGenerator
Lock-free monotonic 64-bit Snowflake ID generator safe for multi-threaded sharing.
SnowflakeId
A 64-bit time-ordered Snowflake identifier ([0 | 41-bit ts | 10-bit node | 12-bit seq]).
Ulid
A 128-bit lexicographically sortable ULID (48-bit ms timestamp | 80-bit entropy).
UlidGenerator
Lock-free monotonic 128-bit ULID generator using atomic state and SplitMix64 entropy.
UuidV7
An RFC 9562 time-ordered 128-bit UUIDv7 identifier.
UuidV7Generator
Lock-free monotonic RFC 9562 UUIDv7 generator (48-bit ts | ver=7 | 12-bit seq | var=10 | 62-bit rnd).

Enums§

IdError
Error type returned by Snowflake, ULID, and UUIDv7 constructors and parsers.

Constants§

DEFAULT_SNOWFLAKE_EPOCH_MS
Default Snowflake custom epoch (2020-01-01T00:00:00Z in Unix milliseconds).
MAX_NODE_ID
Maximum valid 10-bit worker/node identifier (1023).
MAX_SEQUENCE
Maximum 12-bit sequence number per millisecond (4095).
ULID_STR_LEN
Exact ASCII byte length of a canonical Crockford Base32 ULID string.
UUID_STR_LEN
Exact ASCII byte length of a hyphenated canonical UUID string.