Struct flaken::Flaken [] [src]

pub struct Flaken { /* fields omitted */ }

Flaken ID generator, encoder, and decoder

Methods

impl Flaken
[src]

Build a new flake id with the given node id and other default options node: 0 epoch: 2013-01-01T00:00:00Z in milliseconds since the unix epoch bitwidths (42 timestamp bits, 10 id bits, 12 sequence bits)

Set the epoch of a Flaken generator

Set the node id of a Flaken generator

Set the bitwidths of a Flaken generator

generate the next id internally this updates at least the current sequence value, possibly the timestamp value if enough time has elapsed to matter

Encode into a flake id the given id, current time, and sequence value

The current time (ts) is the number of milliseconds passed since the unix epoch

Decode from an encoded id the timestamp, node id, and sequence id The current time (ts) is the number of milliseconds passed since the unix epoch

Trait Implementations

impl Debug for Flaken
[src]

Formats the value using the given formatter.