5 releases
Uses new Rust 2024
| 0.5.5 | Sep 6, 2025 |
|---|---|
| 0.5.4 | Sep 6, 2025 |
| 0.5.3 | Aug 25, 2025 |
| 0.5.2 | Aug 25, 2025 |
| 0.5.1 | Aug 23, 2025 |
#12 in #128-bit
54 downloads per month
Used in 2 crates
32KB
853 lines
souvenir_core
This crate contains implementation details for
souvenir.
This crate is not intended to be used directly.
souvenir
A type-safe, tagged identifier library.
The crate primarily provides the Id struct, which stores a 128-bit
identifier with its corresponding type (tag).
The String representation of an Id is the type's tag and the
128-bit value encoded into a variant of
Crockford Base 32.
Here is a simple example of how this crate can be used.
use souvenir::Id;
let id: Id = Id::random("user".parse().unwrap());
println!("{}", id);
let id2: Id = Id::parse("user_02v58c5a3fy30k560qrtg4").unwrap();
assert_eq!(id2.to_string(), "user_02v58c5a3fy30k560qrtg4");
Integrations for various libraries and databases are also (optionally) available:
Dependencies
~0–21MB
~258K SLoC