snowflake-gen 1.0.1

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
15
/// The decoded components of a Snowflake ID.
///
/// Obtained via [`crate::generator::SnowflakeIdGenerator::decompose`].
#[must_use]
#[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: i64,
    /// Node identifier embedded in the ID.
    pub node_id: i64,
    /// Per-millisecond sequence counter embedded in the ID.
    pub sequence: u32,
}