snowflake-gen 0.1.0

A configurable Snowflake ID generator with custom bit layouts, thread-local global generation, and ID decomposition
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/// The decoded components of a Snowflake ID.
///
/// Obtained via [`crate::generator::SnowflakeIdGenerator::decompose`].
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct SnowflakeComponents {
    /// Milliseconds since the generator's epoch.
    pub timestamp_millis: i64,
    /// Machine identifier embedded in the ID.
    pub machine_id: i32,
    /// Node identifier embedded in the ID.
    pub node_id: i32,
    /// Per-millisecond sequence counter embedded in the ID.
    pub sequence: u16,
}