A Rust library for creating Firebase-style push id:s
This is available as a Crate, here.
Add rust-push-id crate like so:
[dependencies]
pushid = "0.0.1"
The pushid library can then be used like this:
// Reference the crate
extern crate pushid;
// use PushIdGen from the crate
use pushid::PushIdGen;
fn main() {
// Create generator. Remember to make it mutable
let mut push_id_generator = pushid::PushId::new();
// PushId can be generated using 'get_id'
let id = push_id_generator.get_id();
// ... use id here
println!("{}", id);
}
This is my first attempt at rust. Hence, the code is not likely to be idiomatic Rust. I'll gladly accept improvements and PR:s.
I was inspired by this Gist from mikelehen Mine is faster, his is prettier. :)
-Kristofer