https://github.com/liminova/snowflake-rs
Barebone snowflake ID generator, written entirely in safe Rust and 0 dependency.
https://github.com/liminova/snowflake-rs
rust rust-lang rust-library snowflake snowflake-id snowflake-twitter
Last synced: about 1 month ago
JSON representation
Barebone snowflake ID generator, written entirely in safe Rust and 0 dependency.
- Host: GitHub
- URL: https://github.com/liminova/snowflake-rs
- Owner: Liminova
- License: mit
- Created: 2024-11-04T21:00:15.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-11-05T03:56:11.000Z (7 months ago)
- Last Synced: 2025-02-14T12:35:56.157Z (3 months ago)
- Topics: rust, rust-lang, rust-library, snowflake, snowflake-id, snowflake-twitter
- Language: Rust
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# snowflake-rs
> This crate is as completed as my current knowledge allows. It's free of unsafe code for extreme performance tweaks, has zero dependencies, and the compiler doesn't scream at me. Going forward, expect only Rust edition bumps and bug fixes (as if there were any).
## Usage
```bash
cargo add --git https://github.com/Liminova/snowflake-rs
``````rust
use snowflake_rs::Snowflake;let datacenter_id = 1;
let worker_id = 1;
let sequence = 0;let snowflake = Snowflake::new(datacenter_id, worker_id, sequence).build().unwrap();
let id = snowflake.generate_id();
```## License
This project is licensed under the [MIT license](LICENSE).