uuid::timestamp

Trait ClockSequence

Source
pub trait ClockSequence {
    type Output;

    // Required method
    fn generate_sequence(&self, seconds: u64, subsec_nanos: u32) -> Self::Output;

    // Provided methods
    fn generate_timestamp_sequence(
        &self,
        seconds: u64,
        subsec_nanos: u32,
    ) -> (Self::Output, u64, u32) { ... }
    fn usable_bits(&self) -> usize
       where Self::Output: Sized { ... }
}
Expand description

A counter that can be used by versions 1 and 6 UUIDs to support the uniqueness of timestamps.

§References

Required Associated Types§

Source

type Output

The type of sequence returned by this counter.

Required Methods§

Source

fn generate_sequence(&self, seconds: u64, subsec_nanos: u32) -> Self::Output

Get the next value in the sequence to feed into a timestamp.

This method will be called each time a Timestamp is constructed.

Any bits beyond ClockSequence::usable_bits in the output must be unset.

Provided Methods§

Source

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.

This method should be preferred over generate_sequence.

Any bits beyond ClockSequence::usable_bits in the output must be unset.

Source

fn usable_bits(&self) -> usize
where Self::Output: Sized,

The number of usable bits from the least significant bit in the result of ClockSequence::generate_sequence or ClockSequence::generate_timestamp_sequence.

The number of usable bits must not exceed 128.

The number of usable bits is not expected to change between calls. An implementation of ClockSequence should always return the same value from this method.

Implementations on Foreign Types§

Source§

impl<'a, T: ClockSequence + ?Sized> ClockSequence for &'a T

Source§

type Output = <T as ClockSequence>::Output

Source§

fn generate_sequence(&self, seconds: u64, subsec_nanos: u32) -> Self::Output

Source§

fn generate_timestamp_sequence( &self, seconds: u64, subsec_nanos: u32, ) -> (Self::Output, u64, u32)

Source§

fn usable_bits(&self) -> usize
where Self::Output: Sized,

Source§

impl<C: ClockSequence + RefUnwindSafe> ClockSequence for Mutex<C>

Source§

type Output = <C as ClockSequence>::Output

Source§

fn generate_sequence(&self, seconds: u64, subsec_nanos: u32) -> Self::Output

Source§

fn generate_timestamp_sequence( &self, seconds: u64, subsec_nanos: u32, ) -> (Self::Output, u64, u32)

Source§

fn usable_bits(&self) -> usize
where Self::Output: Sized,

Source§

impl<C: ClockSequence> ClockSequence for AssertUnwindSafe<C>

Source§

type Output = <C as ClockSequence>::Output

Source§

fn generate_sequence(&self, seconds: u64, subsec_nanos: u32) -> Self::Output

Source§

fn generate_timestamp_sequence( &self, seconds: u64, subsec_nanos: u32, ) -> (Self::Output, u64, u32)

Source§

fn usable_bits(&self) -> usize
where Self::Output: Sized,

Implementors§