Skip to main content

AtomicBoxedBitSet

Struct AtomicBoxedBitSet 

Source
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>
where A::Item: PrimInt,

Source

pub fn from_boxed_slice(store: Box<[A]>) -> Self

Source§

impl<A: Radium + Default, V> AtomicBoxedBitSet<A, V>
where A::Item: PrimInt,

Source

pub fn with_capacity(bits: usize) -> Self

Source§

impl<A: Radium, V> AtomicBoxedBitSet<A, V>
where A::Item: PrimInt,

Source

pub fn drain(&self) -> BoxedBitSet<A::Item, V>
where A::Item: Default,

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>>§

Source

pub fn as_raw_slice(&self) -> &[A]

Source

pub fn capacity(&self) -> usize

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn first(&self) -> Option<V>
where V: TryFrom<usize>,

Source

pub fn last(&self) -> Option<V>
where V: TryFrom<usize>,

Source

pub fn pop_first(&self) -> Option<V>
where V: TryFrom<usize>, A::Item: BitOps,

Source

pub fn pop_last(&self) -> Option<V>
where V: TryFrom<usize>, A::Item: BitOps,

Source

pub fn contains(&self, id: &V) -> bool
where V: Copy + AsPrimitive<usize>,

Source

pub fn insert(&self, id: V) -> bool
where V: AsPrimitive<usize>, A::Item: BitOps,

Source

pub fn remove(&self, id: V) -> bool
where V: AsPrimitive<usize>, A::Item: BitOps,

Source

pub fn set(&self, id: V, value: bool)
where V: AsPrimitive<usize>, A::Item: BitOps,

Source

pub fn toggle(&self, id: V)
where V: AsPrimitive<usize>, A::Item: BitOps,

Source

pub fn clear(&self)

Source

pub fn retain(&self, f: impl FnMut(V) -> bool)
where V: TryFrom<usize>, A::Item: BitOps,

Source

pub fn iter(&self) -> impl Iterator<Item = V> + '_
where A::Item: BitAndAssign, V: TryFrom<usize>,

Source

pub fn is_subset(&self, other: &Self) -> bool

Source

pub fn is_superset(&self, other: &Self) -> bool

Source

pub fn is_disjoint(&self, other: &Self) -> bool

Source

pub fn union_from(&self, other: &[A::Item])
where A::Item: BitOps + Copy,

Trait Implementations§

Source§

impl<A: Radium, V> Deref for AtomicBoxedBitSet<A, V>
where A::Item: PrimInt,

Source§

type Target = AtomicBitSlice<A, V>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<A, V> Freeze for AtomicBoxedBitSet<A, V>

§

impl<A, V> RefUnwindSafe for AtomicBoxedBitSet<A, V>

§

impl<A, V> Send for AtomicBoxedBitSet<A, V>
where V: Send, A: Send,

§

impl<A, V> Sync for AtomicBoxedBitSet<A, V>
where V: Sync, A: Sync,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.