Trait TimestampProvider

Source
pub trait TimestampProvider {
    type TimestampType: Copy + Sized + From<u64>;

    const TIMESTAMP_VALID_BITS: u8 = _;
    const MAX_VALUE: u64 = _;

    // Required method
    fn now() -> Self::TimestampType;
}
Expand description

TimestampProvider is a source for relatively stable timestamp, which wraps around after reaching maximum value.

Maximum value is defined as unsigned integer composed of TIMESTAMP_VALID_BITS binary ones.

Provided Associated Constants§

Source

const TIMESTAMP_VALID_BITS: u8 = _

Define how many bits are valid in timestamp, returned from now(). Other bits are zeroed.

Source

const MAX_VALUE: u64 = _

Max timestamp value. After reaching this value, next tick will be 0.

Required Associated Types§

Source

type TimestampType: Copy + Sized + From<u64>

Numeric timestamp type, can be either u32 or u64.

Required Methods§

Source

fn now() -> Self::TimestampType

Returns current timestamp from provider.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§