pub struct AtomicUnionFindAccess<'a, Value: AtomicNumericId> { /* private fields */ }Expand description
A concurrent, fixed-capacity view borrowed from a serial UnionFind.
Creating this view requires exclusive access to the serial union-find. The view may be shared with scoped worker threads, and the serial representation becomes accessible again only after all of those borrows have ended.
Operations on this fixed view use relaxed atomics. Parent entries are the only shared state: a successful union changes a root from itself to a strictly smaller ID, and path splitting changes a parent to a strictly smaller ancestor. Consequently links never increase, cannot exhibit ABA, and cannot form a cycle. A stale load is still a same-component ancestor, while every mutation uses compare-exchange to verify the observed link. The scope join before this view is dropped provides the happens-before edge needed before ordinary reads resume; parent links do not publish any other payload.
Implementations§
Source§impl<Value: AtomicNumericId> AtomicUnionFindAccess<'_, Value>
impl<Value: AtomicNumericId> AtomicUnionFindAccess<'_, Value>
Sourcepub fn union(&self, l: Value, r: Value) -> (Value, Value)
pub fn union(&self, l: Value, r: Value) -> (Value, Value)
Merge two equivalence classes.
Panics if either ID exceeds the fixed capacity selected when this view was created.