[][src]Struct akashi::SnowflakeGenerator

pub struct SnowflakeGenerator { /* fields omitted */ }

Generates Snowflake IDs.

Methods

impl SnowflakeGenerator[src]

pub fn new(group_id: u64, worker_id: u64) -> SnowflakeGenerator[src]

Creates a new SnowflakeGenerator.

SnowflakeGenerator instances that are used concurrently should be created with different group and/or worker IDs to ensure that all generated IDs are unique.

pub fn generate(&mut self) -> Snowflake[src]

Generates a new Snowflake ID.

This might cause the current thread to sleep in the rare event that the system clock goes backwards.

Trait Implementations

impl Debug for SnowflakeGenerator[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.