Forked from the archived repository michaelcontento/simpleflake-rs.
Distributed ID generation in rust for the lazy. Based on the python implementation from [SawdustSoftware][].
Just add this crate as a dependency to your Cargo.toml
:
[dependencies.simpleflake]
git = "https://github.com/anixe/simpleflake-rs"
extern crate simpleflake;
let new_id = simpleflake::new();
println!("generated id: {}", new_id);
let parts = simpleflake::parse(new_id);
println!("timestamp: {}", parts.timestamp);
println!("random bits: {}", parts.random_bits);