pub struct VectorClock { /* private fields */ }Expand description
A vector clock for tracking causality between events.
Implementations§
Source§impl VectorClock
impl VectorClock
Sourcepub fn merge(&mut self, other: &VectorClock)
pub fn merge(&mut self, other: &VectorClock)
Merge with another vector clock (take maximum of each component).
Sourcepub fn merged(&self, other: &VectorClock) -> VectorClock
pub fn merged(&self, other: &VectorClock) -> VectorClock
Create a merged clock without modifying self.
Sourcepub fn happened_before(&self, other: &VectorClock) -> bool
pub fn happened_before(&self, other: &VectorClock) -> bool
Check if this clock happened before another.
Sourcepub fn happened_after(&self, other: &VectorClock) -> bool
pub fn happened_after(&self, other: &VectorClock) -> bool
Check if this clock happened after another.
Sourcepub fn is_concurrent(&self, other: &VectorClock) -> bool
pub fn is_concurrent(&self, other: &VectorClock) -> bool
Check if two clocks are concurrent (neither happened before the other).
Sourcepub fn equals(&self, other: &VectorClock) -> bool
pub fn equals(&self, other: &VectorClock) -> bool
Check if two clocks are identical.
Sourcepub fn compare(&self, other: &VectorClock) -> VectorClockOrdering
pub fn compare(&self, other: &VectorClock) -> VectorClockOrdering
Compare two vector clocks.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Get the number of nodes tracked.
Trait Implementations§
Source§impl Clone for VectorClock
impl Clone for VectorClock
Source§fn clone(&self) -> VectorClock
fn clone(&self) -> VectorClock
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VectorClock
impl Debug for VectorClock
Source§impl Default for VectorClock
impl Default for VectorClock
Source§fn default() -> VectorClock
fn default() -> VectorClock
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for VectorClock
impl<'de> Deserialize<'de> for VectorClock
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for VectorClock
impl PartialEq for VectorClock
Source§impl PartialOrd for VectorClock
impl PartialOrd for VectorClock
Source§impl Serialize for VectorClock
impl Serialize for VectorClock
impl Eq for VectorClock
Auto Trait Implementations§
impl Freeze for VectorClock
impl RefUnwindSafe for VectorClock
impl Send for VectorClock
impl Sync for VectorClock
impl Unpin for VectorClock
impl UnsafeUnpin for VectorClock
impl UnwindSafe for VectorClock
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.