Struct miri::concurrency::vector_clock::VClock
source · Expand description
A vector clock for detecting data-races, this is conceptually a map from a vector index (and thus a thread id) to a timestamp. The compare operations require that the invariant that the last element in the internal timestamp slice must not be a 0, hence all zero vector clocks are always represented by the empty slice; and allows for the implementation of compare operations to short circuit the calculation and return the correct result faster, also this means that there is only one unique valid length for each set of vector clock values and hence the PartialEq
Tuple Fields
0: SmallVec<[u32; 4]>
Implementations
sourceimpl VClock
impl VClock
sourcepub fn new_with_index(index: VectorIdx, timestamp: u32) -> VClock
pub fn new_with_index(index: VectorIdx, timestamp: u32) -> VClock
Create a new vector-clock containing all zeros except for a value at the given index
sourcefn get_mut_with_min_len(&mut self, min_len: usize) -> &mut [u32]
fn get_mut_with_min_len(&mut self, min_len: usize) -> &mut [u32]
Get a mutable slice to the internal vector with minimum min_len
elements, to preserve invariants this vector must modify
the min_len
-1 nth element to a non-zero value
sourcepub fn increment_index(&mut self, idx: VectorIdx)
pub fn increment_index(&mut self, idx: VectorIdx)
Increment the vector clock at a known index this will panic if the vector index overflows
pub fn join(&mut self, other: &Self)
sourcepub fn set_at_index(&mut self, other: &Self, idx: VectorIdx)
pub fn set_at_index(&mut self, other: &Self, idx: VectorIdx)
Set the element at the current index of the vector
sourcepub fn set_zero_vector(&mut self)
pub fn set_zero_vector(&mut self)
Set the vector to the all-zero vector
sourcepub fn is_zero_vector(&self) -> bool
pub fn is_zero_vector(&self) -> bool
Return if this vector is the all-zero vector
Trait Implementations
sourceimpl PartialOrd<VClock> for VClock
impl PartialOrd<VClock> for VClock
impl Eq for VClock
impl StructuralEq for VClock
impl StructuralPartialEq for VClock
Auto Trait Implementations
impl RefUnwindSafe for VClock
impl Send for VClock
impl Sync for VClock
impl Unpin for VClock
impl UnwindSafe for VClock
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
Layout
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes