Skip to content

perillamint/timeflake-rs

Repository files navigation

Timeflake-rs

Build Status crates.io License

Timeflake is a 128-bit, roughly-ordered, URL-safe UUID. Inspired by Twitter's Snowflake, Instagram's ID and Firebase's PushID.

Port of https://github.com/anthonynsimon/timeflake in pure Rust

Example code

use Timeflake;

fn main() {
    let time = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
    println!("{}", Timeflake::random().unwrap());
    println!("{}", Timeflake::from_values(time, Some(0)).unwrap());
    println!("{}", Timeflake::from_values(time, None).unwrap());
}

About

Timeflake, in pure Rust.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages