https://github.com/asaaki/yyid.rs
YYID generator in Rust (random tokens like UUIDv4)
https://github.com/asaaki/yyid.rs
c crate crates lib no-std random rust uuid yyid
Last synced: 9 months ago
JSON representation
YYID generator in Rust (random tokens like UUIDv4)
- Host: GitHub
- URL: https://github.com/asaaki/yyid.rs
- Owner: asaaki
- License: apache-2.0
- Created: 2015-09-28T23:02:42.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2025-08-11T19:42:10.000Z (11 months ago)
- Last Synced: 2025-09-29T13:52:21.238Z (9 months ago)
- Topics: c, crate, crates, lib, no-std, random, rust, uuid, yyid
- Language: Rust
- Homepage: https://docs.rs/yyid/
- Size: 121 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# YYID generator in Rust
[](https://github.com/asaaki/yyid.rs/actions?query=workflow%3ARust) [](https://crates.io/crates/yyid) [](https://docs.rs/yyid/)
Generates random tokens that look like [type 4 UUIDs](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29): `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`
In contrast to [RFC 4122](https://tools.ietf.org/rfc/rfc4122.txt), it uses all digits (128bit).
Source of randomness: [getrandom](https://crates.io/crates/getrandom)
## Examples
### Rust
Add `yyid = "*"` to your dependencies section in `Cargo.toml`.
```rust
use yyid::*;
fn main() {
println!("{}", Yyid::new());
// => "02e7f0f6-067e-8c92-b25c-12c9180540a9"
}
```
## Documentation
## Notes
* The current implementation is derived from the [uuid](http://doc.rust-lang.org/uuid/uuid/index.html) 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
- YYID for [Ruby](https://github.com/janlelis/yyid.rb)
- YYID for [JavaScript](https://github.com/janlelis/yyid.js)
- YYID for [Elixir](https://github.com/janlelis/yyid.ex)
- YYID for [Go](https://github.com/janlelis/yyid.go)
## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
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.