pub struct AtomicBoxedBitSet<A, V>(/* private fields */);Expand description
Heap-allocated atomic bitset with dynamically sized storage.
AtomicBoxedBitSet<A, V> is the atomic counterpart of
BoxedBitSet. It owns a Box<[A]> of atomic words
and delegates common operations to AtomicBitSlice<A, V> via Deref.
§Atomicity guarantees
Each individual method (insert, remove, contains, …) performs atomic
operations per word. The bitset as a whole is not a single atomic
unit — concurrent modifications to bits in different words are independent
atomic operations with no cross-word transactional guarantee. See
AtomicBitSlice for details.
Implementations§
Source§impl<A: Radium, V> AtomicBoxedBitSet<A, V>
impl<A: Radium, V> AtomicBoxedBitSet<A, V>
pub fn from_boxed_slice(store: Box<[A]>) -> Self
Source§impl<A: Radium + Default, V> AtomicBoxedBitSet<A, V>
impl<A: Radium + Default, V> AtomicBoxedBitSet<A, V>
pub fn with_capacity(bits: usize) -> Self
Source§impl<A: Radium, V> AtomicBoxedBitSet<A, V>
impl<A: Radium, V> AtomicBoxedBitSet<A, V>
Sourcepub fn drain(&self) -> BoxedBitSet<A::Item, V>
pub fn drain(&self) -> BoxedBitSet<A::Item, V>
Atomically drain all bits, returning a non-atomic BoxedBitSet
containing the drained values. The source is left empty.
Each word is swapped independently — this is NOT an atomic snapshot of the entire bitset.
Methods from Deref<Target = AtomicBitSlice<A, V>>§
pub fn as_raw_slice(&self) -> &[A]
pub fn capacity(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn first(&self) -> Option<V>
pub fn last(&self) -> Option<V>
pub fn pop_first(&self) -> Option<V>
pub fn pop_last(&self) -> Option<V>
pub fn contains(&self, id: &V) -> bool
pub fn insert(&self, id: V) -> bool
pub fn remove(&self, id: V) -> bool
pub fn set(&self, id: V, value: bool)
pub fn toggle(&self, id: V)
pub fn clear(&self)
pub fn retain(&self, f: impl FnMut(V) -> bool)
pub fn iter(&self) -> impl Iterator<Item = V> + '_
pub fn is_subset(&self, other: &Self) -> bool
pub fn is_superset(&self, other: &Self) -> bool
pub fn is_disjoint(&self, other: &Self) -> bool
pub fn union_from(&self, other: &[A::Item])
Trait Implementations§
Auto Trait Implementations§
impl<A, V> Freeze for AtomicBoxedBitSet<A, V>
impl<A, V> RefUnwindSafe for AtomicBoxedBitSet<A, V>where
V: RefUnwindSafe,
A: RefUnwindSafe,
impl<A, V> Send for AtomicBoxedBitSet<A, V>
impl<A, V> Sync for AtomicBoxedBitSet<A, V>
impl<A, V> Unpin for AtomicBoxedBitSet<A, V>where
V: Unpin,
impl<A, V> UnsafeUnpin for AtomicBoxedBitSet<A, V>
impl<A, V> UnwindSafe for AtomicBoxedBitSet<A, V>where
V: UnwindSafe,
A: UnwindSafe,
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