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 for &'a T
where T: ClockSequence + ?Sized,

Sourceยง

type Output = <T as ClockSequence>::Output

Sourceยง

fn generate_sequence( &self, seconds: u64, subsec_nanos: u32, ) -> <&'a T as ClockSequence>::Output

Sourceยง

fn generate_timestamp_sequence( &self, seconds: u64, subsec_nanos: u32, ) -> (<&'a T as ClockSequence>::Output, u64, u32)

Sourceยง

fn usable_bits(&self) -> usize

Sourceยง

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

Sourceยง

impl<C> ClockSequence for Mutex<C>

Sourceยง

type Output = <C as ClockSequence>::Output

Sourceยง

fn generate_sequence( &self, seconds: u64, subsec_nanos: u32, ) -> <Mutex<C> as ClockSequence>::Output

Sourceยง

fn generate_timestamp_sequence( &self, seconds: u64, subsec_nanos: u32, ) -> (<Mutex<C> as ClockSequence>::Output, u64, u32)

Sourceยง

fn usable_bits(&self) -> usize
where <Mutex<C> as ClockSequence>::Output: Sized,

Implementorsยง