Crate leachuuid7

Source
Expand description

§leachuuid7

A UUIDv7 generator conforming to the proposed UUID-7 specification.

The UUID layout is as follows (total 128 bits):

  • 60 bits: Unix timestamp in milliseconds (since the Unix epoch)
  • 4 bits: Version (always 7)
  • 2 bits: Variant (always binary 10)
  • 62 bits: Random

The canonical string representation is in the format: 8-4-4-4-12 hexadecimal digits.

§Example

use leachuuid7::Uuid7;

let uuid = Uuid7::new();
println!("Generated UUIDv7: {}", uuid);

// Parsing from a string validates the version and variant fields.
let parsed: Uuid7 = "0184e1a0-7e2a-7d40-8f3b-5c1a2b3c4d5e".parse()
.expect("Failed to parse UUIDv7");

Structs§

ParseUuid7Error
Error type returned when parsing a UUIDv7 from a string fails.
Uuid7
A UUIDv7 value.