#random #uuid #unique #token #generate

no-std yyid

Yyid generator (random tokens like UUIDv4, but using all the bits)

14 releases

0.7.0 Dec 2, 2022
0.6.0 Apr 26, 2020
0.5.0 Apr 26, 2020
0.2.4 May 26, 2016
0.2.2 Oct 19, 2015

#696 in Data structures

23 downloads per month
Used in sentry-rs

MIT/Apache

27KB
524 lines

YYID generator in Rust

GitHub Workflow Status (branch) yyid on crates.io yyid documentation

Generates random tokens that look like type 4 UUIDs: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

In contrast to RFC 4122, it uses all digits (128bit).

Source of randomness: getrandom

Examples

Rust

Add yyid = "*" to your dependencies section in Cargo.toml.

use yyid::*;

fn main() {
    println!("{}", Yyid::new());
    // => "02e7f0f6-067e-8c92-b25c-12c9180540a9"
}

Documentation

https://docs.rs/yyid/

Notes

  • The current implementation is derived from the uuid crate
  • It does not implement everything (no parsing, only generation of tokens)
  • Functionality will also be reduced down to the reference implementations (see Also Available As)
  • The default format is with hyphens (more human readable by default, only 4 bytes extra)
  • For simplicity only the *Ref types are implemented (no owning structures); format at the latest point possible

Also Available As

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.

Dependencies

~54–330KB