| Crates.io | leachuuid7 |
| lib.rs | leachuuid7 |
| version | 0.1.0 |
| created_at | 2025-03-16 04:41:35.127912+00 |
| updated_at | 2025-03-16 04:41:35.127912+00 |
| description | A UUIDv7 generator conforming 100% to the proposed UUID-7 specification. Named as a clever homage in the UUID space. |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1594174 |
| size | 20,979 |
A UUIDv7 generator written in Rust, conforming 100% to the proposed UUID-7 specification.
This crate generates UUIDs using the current Unix timestamp in milliseconds, a version number of 7, the binary variant 10, and 62 bits of randomness.
UUIDv7 is designed with high concurrency in mind and provides an effective means of generating unique identifiers in distributed systems and asynchronous environments.
UUID layout (128 bits total):
10)The resulting UUID is formatted in the canonical form: 8-4-4-4-12 hexadecimal digits.
Add leachuuid7 to your Cargo.toml:
[dependencies]
leachuuid7 = "0.1.0"
Generate a new UUIDv7:
use leachuuid7::Uuid7;
fn main() {
let uuid = Uuid7::new();
println!("Generated UUIDv7: {}", uuid);
}
Parse a UUIDv7 string:
use leachuuid7::Uuid7;
use std::str::FromStr;
fn main() {
let uuid_str = "0184e1a0-7e2a-7d40-8f3b-5c1a2b3c4d5e";
let uuid = Uuid7::from_str(uuid_str).expect("Invalid UUIDv7 string");
println!("Parsed UUIDv7: {}", uuid);
}
Run the tests with:
cargo test
This project uses GitHub Actions for continuous integration. The CI workflow performs:
cargo fmtcargo clippycargo testcargo build --releasecargo packageSee .github/workflows/ci.yml for more details.
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page if you have any questions or suggestions.
The repository for this project is hosted on GitHub:
https://github.com/copyleftdev/leachuuid7
This project is licensed under the MIT License.
A special thanks to P. Leach and R. Salz, pioneers in UUID development, for inspiring the naming of this crate.