Trait uuid::timestamp::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

§

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>

§

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>

§

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§