Skip to main content

Crate sonyflake

Crate sonyflake 

Source
Expand description

A distributed unique ID generator inspired by Twitter’s Snowflake.

This is a Rust implementation of the original sony/sonyflake, which is written in Go.

§Example

use sonyflake::Sonyflake;

let mut sf = Sonyflake::new().unwrap();
let next_id = sf.next_id().unwrap();
println!("{}", next_id);

Structs§

Builder
A builder to build a Sonyflake generator.
DecomposedSonyflake
A decomposed Sonyflake.
Id
A generated Sonyflake id.
Sonyflake
Sonyflake is a distributed unique ID generator.

Enums§

Error
The error type for this crate.

Functions§

decompose
Break a Sonyflake ID up into its parts.