atomic-snowflake 11.1.0

Zero-dependency lock-free monotonic 64-bit Snowflake ID, 128-bit ULID, and RFC 9562 UUIDv7 generators with stack-buffered Crockford Base32 and hyphenated hex codecs.
Documentation
  • Coverage
  • 100%
    19 out of 19 items documented0 out of 0 items with examples
  • Size
  • Source code size: 45.5 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 607.3 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1s Average build duration of successful builds.
  • all releases: 1s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates-dev/ctares
    2 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • vshengbro

atomic-snowflake

Zero-Dependency Lock-Free Snowflake ID, ULID & RFC 9562 UUIDv7 Generators

crates.io docs.rs Rust 2024 License: MIT

Workspace Overview · API Docs · Agent Engineering Rules


Overview

Provides zero-dependency, lock-free monotonic 64-bit Snowflake ID (SnowflakeGenerator / SnowflakeId), 128-bit Crockford Base32 ULID (UlidGenerator / Ulid), and RFC 9562 UUIDv7 (UuidV7Generator / UuidV7) generators with clock-rollback protection and zero-allocation stack codecs.

This package is part of the ctares unified Rust 2024 workspace and follows the repository's strict module purity, formatting, and dependency-ordered release standards.

Installation & Quick Start

cargo add atomic-snowflake
use atomic_snowflake::*;

let sf: SnowflakeGenerator = SnowflakeGenerator::new(1).expect("valid node id");
let id: SnowflakeId = sf.next_id();
assert_eq!(id.node_id(), 1);

let ulid_gen: UlidGenerator = UlidGenerator::new();
let ulid: Ulid = ulid_gen.next_ulid();
assert_eq!(Ulid::parse(&ulid.to_string()).expect("valid ulid"), ulid);

let uuid_gen: UuidV7Generator = UuidV7Generator::new();
let uuid: UuidV7 = uuid_gen.next_uuid();
assert_eq!(uuid.version(), 7);

License

This project is licensed under the MIT License. See the LICENSE file for details.