[−][src]Struct snowflake::SnowflakeIdGenerator
The SnowflakeIdGenerator
type is snowflake algorithm wrapper.
Implementations
impl SnowflakeIdGenerator
[src]
pub fn new(machine_id: i32, node_id: i32) -> SnowflakeIdGenerator
[src]
Constructs a new SnowflakeIdGenerator
.
Please make sure that machine_id and node_id is small than 32(2^5);
Examples
use snowflake::SnowflakeIdGenerator; let id_generator = SnowflakeIdGenerator::new(1, 1);
pub fn real_time_generate(&mut self) -> i64
[src]
The real_time_generate keep id generate time is eq call method time.
Examples
use snowflake::SnowflakeIdGenerator; let mut id_generator = SnowflakeIdGenerator::new(1, 1); id_generator.real_time_generate();
pub fn generate(&mut self) -> i64
[src]
The basic guarantee time punctuality.
Examples
use snowflake::SnowflakeIdGenerator; let mut id_generator = SnowflakeIdGenerator::new(1, 1); id_generator.generate();
pub fn lazy_generate(&mut self) -> i64
[src]
The lazy generate.
Examples
use snowflake::SnowflakeIdGenerator; let mut id_generator = SnowflakeIdGenerator::new(1, 1); id_generator.lazy_generate();
Trait Implementations
impl Clone for SnowflakeIdGenerator
[src]
pub fn clone(&self) -> SnowflakeIdGenerator
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for SnowflakeIdGenerator
[src]
impl Debug for SnowflakeIdGenerator
[src]
Auto Trait Implementations
impl RefUnwindSafe for SnowflakeIdGenerator
[src]
impl Send for SnowflakeIdGenerator
[src]
impl Sync for SnowflakeIdGenerator
[src]
impl Unpin for SnowflakeIdGenerator
[src]
impl UnwindSafe for SnowflakeIdGenerator
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,