Skip to content

A high-performance unique-id library for rust

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

Stebalien/snowflake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

A crate for quickly generating unique IDs with guaranteed properties. This library is completely unrelated to twitter's snowflake library.

This crate currently includes guaranteed process unique IDs but may include new ID types in the future.

API Docs: https://stebalien.github.io/snowflake/snowflake/

Usage

Add this to your Cargo.toml:

[dependencies]
snowflake = "1.2"

and this to your create root:

extern crate snowflake;

To add support for serialization and deserialization using serde, add this to your Cargo.toml:

[dependences]
snowflake = { version = "1.2", features = ["serde_support"] }

Warning: there is a risk of non-unique IDs if (de)serialization is used to persist IDs, i.e. reading and writing IDs to and from a file.

Getting Started

use snowflake::ProcessUniqueId;

fn main() {
  let id1 = ProcessUniqueId::new();
  let id2 = ProcessUniqueId::new();
  println!("{}", id2);
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

A high-performance unique-id library for rust

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages