[][src]Struct hybrid_clocks::Timestamp

pub struct Timestamp<T> {
    pub epoch: u32,
    pub time: T,
    pub count: u32,
}

A value that represents a logical timestamp.

These allow us to describe at least a partial ordering over events, in the same style as Lamport Clocks. In summary, if a < b then we can say that a logically happens-before b. Because they are scalar values, they can't be used to tell between whether:

  • a happenned concurrently with b, or
  • a is part of b's causal history, or vica-versa.

Fields

epoch: u32

An epoch counter.

time: T

The Wall-clock time as returned by the clock source.

count: u32

A Lamport clock used to disambiguate events that are given the same Wall-clock time. This is reset whenever time is incremented.

Methods

impl Timestamp<WallMST>[src]

pub fn to_bytes(&self) -> [u8; 16][src]

pub fn from_bytes(bytes: [u8; 16]) -> Self[src]

impl Timestamp<WallNST>[src]

pub fn write_bytes<W: Write>(&self, wr: W) -> Result<(), Error>[src]

pub fn to_bytes(&self) -> [u8; 16][src]

pub fn read_bytes<R: Read>(r: R) -> Result<Self, Error>[src]

pub fn from_bytes(bytes: [u8; 16]) -> Self[src]

impl<T> Timestamp<T>[src]

pub fn time_into<U: From<T>>(self) -> Timestamp<U>[src]

Trait Implementations

impl<T: PartialEq> PartialEq<Timestamp<T>> for Timestamp<T>[src]

impl<T: Clone> Clone for Timestamp<T>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Ord> Ord for Timestamp<T>[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl<T: Eq> Eq for Timestamp<T>[src]

impl<T: Copy> Copy for Timestamp<T>[src]

impl<T: PartialOrd> PartialOrd<Timestamp<T>> for Timestamp<T>[src]

impl<T: Debug> Debug for Timestamp<T>[src]

impl<T: Display> Display for Timestamp<T>[src]

impl<T: Hash> Hash for Timestamp<T>[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl<T> Send for Timestamp<T> where
    T: Send

impl<T> Sync for Timestamp<T> where
    T: Sync

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]