Struct hybrid_clocks::Timestamp
[−]
[src]
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 withb
, ora
is part ofb
'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<WallT>
[src]
fn write_bytes<W: Write>(&self, wr: W) -> Result<(), Error>
fn read_bytes<R: Read>(r: R) -> Result<Self, Error>
Trait Implementations
impl<T: Hash> Hash for Timestamp<T>
[src]
fn hash<__HT: Hasher>(&self, __arg_0: &mut __HT)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl<T: Ord> Ord for Timestamp<T>
[src]
fn cmp(&self, __arg_0: &Timestamp<T>) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<T: PartialOrd> PartialOrd for Timestamp<T>
[src]
fn partial_cmp(&self, __arg_0: &Timestamp<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, __arg_0: &Timestamp<T>) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, __arg_0: &Timestamp<T>) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, __arg_0: &Timestamp<T>) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, __arg_0: &Timestamp<T>) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T: Eq> Eq for Timestamp<T>
[src]
impl<T: PartialEq> PartialEq for Timestamp<T>
[src]
fn eq(&self, __arg_0: &Timestamp<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Timestamp<T>) -> bool
This method tests for !=
.
impl<T: Copy> Copy for Timestamp<T>
[src]
impl<T: Clone> Clone for Timestamp<T>
[src]
fn clone(&self) -> Timestamp<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more