pub struct VectorClock<const N: usize> {
pub clock: [u64; N],
}Expand description
Per-node monotonic counters. N is the number of nodes in the
system; clock[i] is node i’s observed event count. Causal
ordering: a causally precedes b when every component of a
is <= the corresponding component of b, with at least one
strict less-than.
Fields§
§clock: [u64; N]Implementations§
Source§impl<const N: usize> VectorClock<N>
impl<const N: usize> VectorClock<N>
pub const fn zero() -> Self
pub fn increment(&mut self, node_idx: usize)
Sourcepub fn causal_cmp(&self, other: &Self) -> Option<Ordering>
pub fn causal_cmp(&self, other: &Self) -> Option<Ordering>
Causal-order check: returns Less when self happens-before
other (every component <= and at least one <), Greater when
other happens-before self, Equal when identical, None
when concurrent (incomparable).
pub fn merge(&self, other: &Self) -> Self
Trait Implementations§
Source§impl<const N: usize> Clone for VectorClock<N>
impl<const N: usize> Clone for VectorClock<N>
Source§fn clone(&self) -> VectorClock<N>
fn clone(&self) -> VectorClock<N>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<const N: usize> Copy for VectorClock<N>
Source§impl<const N: usize> Debug for VectorClock<N>
impl<const N: usize> Debug for VectorClock<N>
impl<const N: usize> Eq for VectorClock<N>
Source§impl<const N: usize> Hash for VectorClock<N>
impl<const N: usize> Hash for VectorClock<N>
Source§impl<const N: usize> PartialEq for VectorClock<N>
impl<const N: usize> PartialEq for VectorClock<N>
impl<const N: usize> StructuralPartialEq for VectorClock<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for VectorClock<N>
impl<const N: usize> RefUnwindSafe for VectorClock<N>
impl<const N: usize> Send for VectorClock<N>
impl<const N: usize> Sync for VectorClock<N>
impl<const N: usize> Unpin for VectorClock<N>
impl<const N: usize> UnsafeUnpin for VectorClock<N>
impl<const N: usize> UnwindSafe for VectorClock<N>
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