[][src]Struct snowflake::SnowflakeIdBucket

pub struct SnowflakeIdBucket { /* fields omitted */ }

The SnowflakeIdBucket type is snowflake-id-bucket it easy to get id also have a id buffer.

Implementations

impl SnowflakeIdBucket[src]

pub fn new(machine_id: i32, node_id: i32) -> Self[src]

Constructs a new SnowflakeIdBucket. Please make sure that machine_id and node_id is small than 32(2^5);

Examples

use snowflake::SnowflakeIdBucket;

let id_generator_bucket = SnowflakeIdBucket::new(1, 1);

pub fn get_id(&mut self) -> i64[src]

Generate id.

Examples

use snowflake::SnowflakeIdBucket;

let mut id_generator_bucket = SnowflakeIdBucket::new(1, 1);
let id = id_generator_bucket.get_id();

pub fn generate_ids(&mut self)[src]

Trait Implementations

impl Clone for SnowflakeIdBucket[src]

impl Debug for SnowflakeIdBucket[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> From<T> for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.