pub enum IdMode {
Sequential,
Spread,
}Expand description
Ordering mode encoded in a Qubit snowflake ID.
Variants§
Sequential
Timestamp bits are stored in normal order, producing time-ordered IDs.
Spread
Timestamp bits are reversed, spreading adjacent timestamps across the ID space.
Implementations§
Source§impl IdMode
impl IdMode
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 IdMode::Sequential and 1 for IdMode::Spread.
Sourcepub const fn from_bit(bit: u64) -> Self
pub const fn from_bit(bit: u64) -> Self
Decodes an ID mode from a one-bit value.
§Parameters
bit: Encoded one-bit mode value.
§Returns
IdMode::Sequential for 0; IdMode::Spread for every non-zero
value after masking by callers.
Trait Implementations§
impl Copy for IdMode
impl Eq for IdMode
impl StructuralPartialEq for IdMode
Auto Trait Implementations§
impl Freeze for IdMode
impl RefUnwindSafe for IdMode
impl Send for IdMode
impl Sync for IdMode
impl Unpin for IdMode
impl UnsafeUnpin for IdMode
impl UnwindSafe for IdMode
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