pub enum TimestampPrecision {
Millisecond,
Second,
}Expand description
Timestamp precision encoded in a Qubit snowflake ID.
Variants§
Millisecond
Millisecond precision with 41 timestamp bits and 12 sequence bits.
Second
Second precision with 31 timestamp bits and 22 sequence bits.
Implementations§
Source§impl TimestampPrecision
impl TimestampPrecision
Sourcepub const fn ordinal(self) -> u64
pub const fn ordinal(self) -> u64
Returns the one-bit ordinal used by the Qubit layout.
§Returns
0 for millisecond precision and 1 for second precision.
Sourcepub const fn from_bit(bit: u64) -> Self
pub const fn from_bit(bit: u64) -> Self
Decodes timestamp precision from a one-bit value.
§Parameters
bit: Encoded one-bit precision value.
§Returns
TimestampPrecision::Millisecond for 0; TimestampPrecision::Second
for every non-zero value after masking by callers.
Sourcepub const fn timestamp_bits(self) -> u8
pub const fn timestamp_bits(self) -> u8
Sourcepub const fn sequence_bits(self) -> u8
pub const fn sequence_bits(self) -> u8
Sourcepub const fn divisor_millis(self) -> u64
pub const fn divisor_millis(self) -> u64
Returns the time unit divisor in milliseconds.
§Returns
1 for millisecond precision and 1000 for second precision.
Sourcepub const fn wait_duration_millis(self) -> u64
pub const fn wait_duration_millis(self) -> u64
Returns the sleep duration used while waiting for a new time slice.
§Returns
Wait duration in milliseconds.
Trait Implementations§
Source§impl Clone for TimestampPrecision
impl Clone for TimestampPrecision
Source§fn clone(&self) -> TimestampPrecision
fn clone(&self) -> TimestampPrecision
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TimestampPrecision
impl Debug for TimestampPrecision
Source§impl Hash for TimestampPrecision
impl Hash for TimestampPrecision
Source§impl PartialEq for TimestampPrecision
impl PartialEq for TimestampPrecision
Source§fn eq(&self, other: &TimestampPrecision) -> bool
fn eq(&self, other: &TimestampPrecision) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for TimestampPrecision
impl Eq for TimestampPrecision
impl StructuralPartialEq for TimestampPrecision
Auto Trait Implementations§
impl Freeze for TimestampPrecision
impl RefUnwindSafe for TimestampPrecision
impl Send for TimestampPrecision
impl Sync for TimestampPrecision
impl Unpin for TimestampPrecision
impl UnsafeUnpin for TimestampPrecision
impl UnwindSafe for TimestampPrecision
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