#id #distributed-id #uuid #lazy-evaluation #generation

simpleflake

Distributed ID generation in Rust for the lazy

4 releases

Uses old Rust 2015

0.0.4 Apr 5, 2015
0.0.3 Mar 29, 2015
0.0.2 Jan 16, 2015
0.0.1 Dec 29, 2014

#12 in #distributed-id

MIT license

3KB

simpleflake-rs

Travis Status: Build Status

Distributed ID generation in rust for the lazy. Based on the awesome python implementation from SawdustSoftware.

You can read an overview of what this does and why it came into being at the Sawdust Software Blog.

Installation

Just add this crate as a dependency to your Cargo.toml:

[dependencies.simpleflake]
git = "https://github.com/michaelcontento/simpleflake-rs.git"

Usage

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);

Dependencies

~1MB
~18K SLoC