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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more