pub struct Snowflake {
pub timestamp: u64,
pub instance: u16,
pub sequence: u16,
}Expand description
Snowflake structure
Fields§
§timestamp: u64Timestamp in ms since snowflake epoch start
instance: u16Instance of the snowflake (see schema in readme)
sequence: u16Sequence of the snowflake (see schema in readme)
Implementations§
Source§impl Snowflake
impl Snowflake
Sourcepub fn from_context() -> Self
pub fn from_context() -> Self
New snowflake based on context values
Sourcepub fn get_unix_timestamp(&self) -> u64
pub fn get_unix_timestamp(&self) -> u64
Return UNIX timestamp in ms of snowflake
Sourcepub fn to_decimal(&self) -> i64
pub fn to_decimal(&self) -> i64
Return decimal value of snowflake
Trait Implementations§
impl Copy for Snowflake
impl StructuralPartialEq for Snowflake
Auto Trait Implementations§
impl Freeze for Snowflake
impl RefUnwindSafe for Snowflake
impl Send for Snowflake
impl Sync for Snowflake
impl Unpin for Snowflake
impl UnwindSafe for Snowflake
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more