Skip to main content

Module uuid

Module uuid 

Source
Available on crate feature uuid only.
Expand description

§UUID generation

UUID v4 (random) and v7 (time-ordered) per RFC 9562.

UUIDs produced by this module set the version and variant bits exactly as the RFC requires, so they round-trip through any conformant parser.

use id_forge::uuid::Uuid;

let v4 = Uuid::v4();
let v7 = Uuid::v7();
let parsed = Uuid::parse_str(&v4.to_string()).unwrap();
assert_eq!(v4, parsed);
assert_eq!(v7.to_string().len(), 36);

§Randomness

The random portion is filled by an inline xoshiro256** generator seeded from process ID, wall-clock nanoseconds, and a per-process counter. This is fast and unpredictable across processes, but it is not cryptographically secure — use a CSPRNG for session tokens or API keys.

Structs§

Uuid
A 128-bit UUID.

Enums§

ParseError
Error returned by Uuid::parse_str.