This is a Rust implementation of the ulid project
See the codeThis is a Rust implementation of the ulid project which provides Universally Unique Lexicographically Sortable Identifiers.
use ulid::Ulid;
// Generate a ulid
let ulid = Ulid::generate();
// Generate a string for a ulid
let s = ulid.to_string();
// Create from a String
let res = Ulid::from_string(&s);
assert_eq!(ulid, res.unwrap());
std (default): Flag to toggle use of std and rand. Disable this flag for #[no_std] support.serde: Enables serialization and deserialization of Ulid types via serde. ULIDs are serialized using their canonical 26-character representation as defined in the ULID standard. An optional ulid_as_u128 module is provided, which enables serialization through an Ulid's inner u128 primitive type. See the documentation and serde docs for more information.uuid: Implements infallible conversions between ULIDs and UUIDs from the uuid crate via the std::convert::From trait.Benchmarks were run on my desktop (Win 10/WSL2 Ubuntu; Ryzen 7 5950x). Run them yourself with cargo bench.
test bench_from_string ... bench: 13 ns/iter (+/- 0)
test bench_from_time ... bench: 13 ns/iter (+/- 0)
test bench_generator_generate ... bench: 29 ns/iter (+/- 0)
test bench_new ... bench: 31 ns/iter (+/- 1)
test bench_to_str ... bench: 7 ns/iter (+/- 0)
test bench_to_string ... bench: 19 ns/iter (+/- 0)
Ulid::gen() (previously Ulid::new()) to Ulid::generate() for better compatability with edition 2024rand = "0.10"MonotonicError::Overflow with Overflow. Generator results can now be properly overflowed using Overflow::commit_overflow_random() or Overflow::commit_overflow_random().
Overflow value. generator.generate().map_err(|_| MyOverflowError)Ulid::new() to Ulid::new() for better compatability with edition 2024Ulid::max() and Ulid::is_max()const to Ulid::array_to_str() (Thanks Hermholtz)Ulid::to_str()1,052 followers · starred Nov 2025
480 followers · starred Oct 2024
848 followers · starred Mar 2023
977 followers · starred Jun 2025
This is a Rust implementation of the ulid project
See the codeThis is a Rust implementation of the ulid project which provides Universally Unique Lexicographically Sortable Identifiers.
use ulid::Ulid;
// Generate a ulid
let ulid = Ulid::generate();
// Generate a string for a ulid
let s = ulid.to_string();
// Create from a String
let res = Ulid::from_string(&s);
assert_eq!(ulid, res.unwrap());
std (default): Flag to toggle use of std and rand. Disable this flag for #[no_std] support.serde: Enables serialization and deserialization of Ulid types via serde. ULIDs are serialized using their canonical 26-character representation as defined in the ULID standard. An optional ulid_as_u128 module is provided, which enables serialization through an Ulid's inner u128 primitive type. See the documentation and serde docs for more information.uuid: Implements infallible conversions between ULIDs and UUIDs from the uuid crate via the std::convert::From trait.Benchmarks were run on my desktop (Win 10/WSL2 Ubuntu; Ryzen 7 5950x). Run them yourself with cargo bench.
test bench_from_string ... bench: 13 ns/iter (+/- 0)
test bench_from_time ... bench: 13 ns/iter (+/- 0)
test bench_generator_generate ... bench: 29 ns/iter (+/- 0)
test bench_new ... bench: 31 ns/iter (+/- 1)
test bench_to_str ... bench: 7 ns/iter (+/- 0)
test bench_to_string ... bench: 19 ns/iter (+/- 0)
Ulid::gen() (previously Ulid::new()) to Ulid::generate() for better compatability with edition 2024rand = "0.10"MonotonicError::Overflow with Overflow. Generator results can now be properly overflowed using Overflow::commit_overflow_random() or Overflow::commit_overflow_random().
Overflow value. generator.generate().map_err(|_| MyOverflowError)Ulid::new() to Ulid::new() for better compatability with edition 2024Ulid::max() and Ulid::is_max()const to Ulid::array_to_str() (Thanks Hermholtz)Ulid::to_str()1,052 followers · starred Nov 2025
480 followers · starred Oct 2024
848 followers · starred Mar 2023
977 followers · starred Jun 2025