pub struct ContextV7 { /* private fields */ }
Expand description
An unsynchronized, reseeding counter that produces 42-bit values.
This type works by:
- Reseeding the counter each millisecond with a random 41-bit value. The 42nd bit is left unset so the counter can safely increment over the millisecond.
- Wrapping the counter back to zero if it overflows its 42-bit storage and adding a millisecond to the timestamp.
This type can be used when constructing version 7 UUIDs. When used to construct a version 7 UUID, the 42-bit counter will be padded with random data. This type can be used to maintain ordering of UUIDs within the same millisecond.
This type should not be used when constructing version 1 or version 6 UUIDs. When used to construct a version 1 or version 6 UUID, only the 14 least significant bits of the counter will be used.
Implementations§
Trait Implementations§
source§impl ClockSequence for ContextV7
impl ClockSequence for ContextV7
source§fn generate_sequence(&self, seconds: u64, subsec_nanos: u32) -> Self::Output
fn generate_sequence(&self, seconds: u64, subsec_nanos: u32) -> Self::Output
Get the next value in the sequence to feed into a timestamp. Read more
source§fn generate_timestamp_sequence(
&self,
seconds: u64,
subsec_nanos: u32,
) -> (Self::Output, u64, u32)
fn generate_timestamp_sequence( &self, seconds: u64, subsec_nanos: u32, ) -> (Self::Output, u64, u32)
Get the next value in the sequence, potentially also adjusting the timestamp. Read more
source§fn usable_bits(&self) -> usize
fn usable_bits(&self) -> usize
The number of usable bits from the least significant bit in the result of
ClockSequence::generate_sequence
or ClockSequence::generate_timestamp_sequence
. Read moreimpl RefUnwindSafe for ContextV7
Auto Trait Implementations§
impl !Freeze for ContextV7
impl Send for ContextV7
impl !Sync for ContextV7
impl Unpin for ContextV7
impl UnwindSafe for ContextV7
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