pub struct AtomicSet<K>(/* private fields */);Expand description
A lock-free concurrent set optimized for read-heavy access patterns.
Reads are a single atomic pointer load with no contention between readers. Writes clone the inner set, mutate the clone, and atomically swap it in.
Not safe for concurrent writers using load/store: the last store wins
and earlier updates are silently lost. Use rcu when multiple
writers may race, or restrict writes to a single task.
Wrap in Arc for shared ownership across threads.
Implementations§
Source§impl<K> AtomicSet<K>
impl<K> AtomicSet<K>
Trait Implementations§
Auto Trait Implementations§
impl<K> !Freeze for AtomicSet<K>
impl<K> RefUnwindSafe for AtomicSet<K>where
K: RefUnwindSafe,
impl<K> Send for AtomicSet<K>
impl<K> Sync for AtomicSet<K>
impl<K> Unpin for AtomicSet<K>
impl<K> UnsafeUnpin for AtomicSet<K>
impl<K> UnwindSafe for AtomicSet<K>where
K: RefUnwindSafe,
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