id_forge/lib.rs
1//! # id-forge
2//!
3//! Typed, high-performance unique ID generation for Rust. Every common
4//! ID scheme in one zero-dependency library:
5//!
6//! - **[`uuid`]**: UUID v4 (random) and v7 (time-ordered)
7//! - **[`ulid`]**: Universally Unique Lexicographically Sortable ID
8//! - **[`snowflake`]**: Twitter Snowflake-style 64-bit IDs (epoch + worker + sequence)
9//! - **[`nanoid`]**: URL-safe random strings of any length
10//!
11//! ## Quick example
12//!
13//! ```
14//! use id_forge::uuid::Uuid;
15//!
16//! let id = Uuid::v4();
17//! println!("{id}");
18//! ```
19//!
20//! ## Why this library exists
21//!
22//! Today's options are fragmented: `uuid` for UUIDs, `ulid` for ULIDs,
23//! `snowflake-rs` for snowflakes, `nanoid` for NanoIDs. Each has its
24//! own quirks, MSRV, and dependencies. `id-forge` is one zero-dep
25//! crate at MSRV 1.75 covering every scheme.
26//!
27//! ## Status
28//!
29//! `v0.9.0` ships the real UUID v4 and v7 implementations per RFC 9562
30//! with an inline xoshiro256\*\* random source. ULID, Snowflake, and
31//! NanoID remain placeholders until `0.9.1`, `0.9.2`, and `0.9.3`.
32
33#![cfg_attr(docsrs, feature(doc_cfg))]
34#![cfg_attr(not(feature = "std"), no_std)]
35#![warn(missing_docs)]
36#![warn(rust_2018_idioms)]
37
38#[cfg(feature = "uuid")]
39pub mod uuid;
40
41#[cfg(feature = "ulid")]
42pub mod ulid;
43
44#[cfg(feature = "snowflake")]
45pub mod snowflake;
46
47#[cfg(feature = "nanoid")]
48pub mod nanoid;