Skip to content

A Rust library for creating Firebase-style push id:s

License

Notifications You must be signed in to change notification settings

silverbeak/rust-push-id

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Push Id

A Rust library for creating Firebase-style push id:s

Crate

This is available as a Crate, here.

Usage

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

NB

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.

Credits

I was inspired by this Gist from mikelehen Mine is faster, his is prettier. :)

-Kristofer

trollmoj.com

About

A Rust library for creating Firebase-style push id:s

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages