pub struct BitSet<A, V>(/* private fields */);Implementations§
Source§impl<A: PrimStore, V> BitSet<A, V>
impl<A: PrimStore, V> BitSet<A, V>
pub const fn new() -> Self
pub fn from_element(elem: V) -> Selfwhere
V: AsPrimitive<usize>,
pub fn into_bits(self) -> A
pub fn union(&self, other: &A) -> BitSet<A, V>
pub fn difference(&self, other: &A) -> BitSet<A, V>
pub fn includes(&self, other: &A) -> bool
Sourcepub fn iter(&self) -> PrimBitSetIter<A, V> ⓘwhere
A: PrimInt,
pub fn iter(&self) -> PrimBitSetIter<A, V> ⓘwhere
A: PrimInt,
Snapshot iterator over set bit positions. Copies the raw bits, so the bitset can be mutated while iterating.
pub fn load_store(&self) -> Awhere
A: Copy,
pub fn swap_store(&mut self, store: &mut A)
pub fn mut_store(&mut self, f: impl Fn(&mut A))
pub fn drain(&mut self) -> PrimBitSetIter<A, V> ⓘ
pub fn union_from(&mut self, other: A)where
A: Copy + BitOrAssign<A>,
pub fn set(&mut self, id: V, value: bool)where
V: AsPrimitive<usize>,
pub fn insert(&mut self, id: V) -> boolwhere
V: AsPrimitive<usize>,
pub fn remove(&mut self, id: V) -> boolwhere
V: AsPrimitive<usize>,
pub fn toggle(&mut self, id: V)where
V: AsPrimitive<usize>,
Source§impl<V> BitSet<u8, V>
impl<V> BitSet<u8, V>
Sourcepub const fn from_index(idx: usize) -> Self
pub const fn from_index(idx: usize) -> Self
Const constructor from a single bit index.
Sourcepub const fn from_indices(indices: &[usize]) -> Self
pub const fn from_indices(indices: &[usize]) -> Self
Const constructor from a slice of bit indices.
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
pub const fn is_subset(&self, other: &Self) -> bool
pub const fn is_superset(&self, other: &Self) -> bool
pub const fn is_disjoint(&self, other: &Self) -> bool
Source§impl<V> BitSet<u16, V>
impl<V> BitSet<u16, V>
Sourcepub const fn from_index(idx: usize) -> Self
pub const fn from_index(idx: usize) -> Self
Const constructor from a single bit index.
Sourcepub const fn from_indices(indices: &[usize]) -> Self
pub const fn from_indices(indices: &[usize]) -> Self
Const constructor from a slice of bit indices.
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
pub const fn is_subset(&self, other: &Self) -> bool
pub const fn is_superset(&self, other: &Self) -> bool
pub const fn is_disjoint(&self, other: &Self) -> bool
Source§impl<V> BitSet<u32, V>
impl<V> BitSet<u32, V>
Sourcepub const fn from_index(idx: usize) -> Self
pub const fn from_index(idx: usize) -> Self
Const constructor from a single bit index.
Sourcepub const fn from_indices(indices: &[usize]) -> Self
pub const fn from_indices(indices: &[usize]) -> Self
Const constructor from a slice of bit indices.
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
pub const fn is_subset(&self, other: &Self) -> bool
pub const fn is_superset(&self, other: &Self) -> bool
pub const fn is_disjoint(&self, other: &Self) -> bool
Source§impl<V> BitSet<u64, V>
impl<V> BitSet<u64, V>
Sourcepub const fn from_index(idx: usize) -> Self
pub const fn from_index(idx: usize) -> Self
Const constructor from a single bit index.
Sourcepub const fn from_indices(indices: &[usize]) -> Self
pub const fn from_indices(indices: &[usize]) -> Self
Const constructor from a slice of bit indices.
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
pub const fn is_subset(&self, other: &Self) -> bool
pub const fn is_superset(&self, other: &Self) -> bool
pub const fn is_disjoint(&self, other: &Self) -> bool
Source§impl<V> BitSet<u128, V>
impl<V> BitSet<u128, V>
Sourcepub const fn from_index(idx: usize) -> Self
pub const fn from_index(idx: usize) -> Self
Const constructor from a single bit index.
Sourcepub const fn from_indices(indices: &[usize]) -> Self
pub const fn from_indices(indices: &[usize]) -> Self
Const constructor from a slice of bit indices.
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
pub const fn is_subset(&self, other: &Self) -> bool
pub const fn is_superset(&self, other: &Self) -> bool
pub const fn is_disjoint(&self, other: &Self) -> bool
Source§impl<V> BitSet<usize, V>
impl<V> BitSet<usize, V>
Sourcepub const fn from_index(idx: usize) -> Self
pub const fn from_index(idx: usize) -> Self
Const constructor from a single bit index.
Sourcepub const fn from_indices(indices: &[usize]) -> Self
pub const fn from_indices(indices: &[usize]) -> Self
Const constructor from a slice of bit indices.
pub const fn len(&self) -> usize
pub const fn is_empty(&self) -> bool
pub const fn is_subset(&self, other: &Self) -> bool
pub const fn is_superset(&self, other: &Self) -> bool
pub const fn is_disjoint(&self, other: &Self) -> bool
Source§impl<T: PrimStore, V, const N: usize> BitSet<[T; N], V>
impl<T: PrimStore, V, const N: usize> BitSet<[T; N], V>
pub const fn new() -> Self
pub const fn empty() -> Self
pub fn from_bits(raw: [T; N]) -> Self
pub fn from_element(id: V) -> Self
pub fn into_bits(self) -> [T; N]
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 as_slice(&self) -> &[T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Methods from Deref<Target = BitSlice<A, V>>§
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(&mut self) -> Option<V>
pub fn pop_last(&mut self) -> Option<V>
pub fn contains(&self, id: &V) -> bool
pub fn set(&mut self, id: V, value: bool)where
V: AsPrimitive<usize>,
pub fn insert(&mut self, id: V) -> boolwhere
V: AsPrimitive<usize>,
pub fn remove(&mut self, id: V) -> boolwhere
V: AsPrimitive<usize>,
pub fn toggle(&mut self, id: V)where
V: AsPrimitive<usize>,
pub fn clear(&mut self)
pub fn retain(&mut self, f: impl FnMut(V) -> bool)
pub fn append(&mut self, other: &mut Self)
pub fn iter(&self) -> BitSliceIter<'_, T, 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 difference<'a>(&'a self, other: &'a Self) -> impl Iterator<Item = V> + 'a
pub fn intersection<'a>( &'a self, other: &'a Self, ) -> impl Iterator<Item = V> + 'a
pub fn union<'a>(&'a self, other: &'a Self) -> impl Iterator<Item = V> + 'a
pub fn symmetric_difference<'a>( &'a self, other: &'a Self, ) -> impl Iterator<Item = V> + 'a
Trait Implementations§
Source§impl<T, V, const N: usize> BitAndAssign for BitSet<[T; N], V>
impl<T, V, const N: usize> BitAndAssign for BitSet<[T; N], V>
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
Performs the
&= operation. Read moreSource§impl<A: PrimStore + BitAndAssign, V> BitAndAssign for BitSet<A, V>
impl<A: PrimStore + BitAndAssign, V> BitAndAssign for BitSet<A, V>
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
Performs the
&= operation. Read moreSource§impl<T, V, const N: usize> BitOrAssign for BitSet<[T; N], V>
impl<T, V, const N: usize> BitOrAssign for BitSet<[T; N], V>
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the
|= operation. Read moreSource§impl<A: PrimStore + BitOrAssign, V> BitOrAssign for BitSet<A, V>
impl<A: PrimStore + BitOrAssign, V> BitOrAssign for BitSet<A, V>
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the
|= operation. Read moreSource§impl<T, V, const N: usize> BitXorAssign for BitSet<[T; N], V>
impl<T, V, const N: usize> BitXorAssign for BitSet<[T; N], V>
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
Performs the
^= operation. Read moreSource§impl<A: PrimStore + BitXorAssign, V> BitXorAssign for BitSet<A, V>
impl<A: PrimStore + BitXorAssign, V> BitXorAssign for BitSet<A, V>
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
Performs the
^= operation. Read moreSource§impl<T: PrimStore + BitOrAssign + Copy, V, const N: usize> Extend<BitSet<[T; N], V>> for BitSet<[T; N], V>
impl<T: PrimStore + BitOrAssign + Copy, V, const N: usize> Extend<BitSet<[T; N], V>> for BitSet<[T; N], V>
Source§fn extend<I: IntoIterator<Item = Self>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = Self>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<A: PrimStore + BitOrAssign + Copy, V> Extend<BitSet<A, V>> for BitSet<A, V>
impl<A: PrimStore + BitOrAssign + Copy, V> Extend<BitSet<A, V>> for BitSet<A, V>
Source§fn extend<I: IntoIterator<Item = Self>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = Self>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<T: PrimStore, V: AsPrimitive<usize>, const N: usize> Extend<V> for BitSet<[T; N], V>
impl<T: PrimStore, V: AsPrimitive<usize>, const N: usize> Extend<V> for BitSet<[T; N], V>
Source§fn extend<I: IntoIterator<Item = V>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = V>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<A: Copy + PrimStore, V: AsPrimitive<usize>> Extend<V> for BitSet<A, V>
impl<A: Copy + PrimStore, V: AsPrimitive<usize>> Extend<V> for BitSet<A, V>
Source§fn extend<I: IntoIterator<Item = V>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = V>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<T: PrimStore + BitOrAssign + Copy, V, const N: usize> FromIterator<BitSet<[T; N], V>> for BitSet<[T; N], V>
impl<T: PrimStore + BitOrAssign + Copy, V, const N: usize> FromIterator<BitSet<[T; N], V>> for BitSet<[T; N], V>
Source§fn from_iter<I: IntoIterator<Item = Self>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Self>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl<A: PrimStore + BitOrAssign + Copy, V> FromIterator<BitSet<A, V>> for BitSet<A, V>
impl<A: PrimStore + BitOrAssign + Copy, V> FromIterator<BitSet<A, V>> for BitSet<A, V>
Source§fn from_iter<I: IntoIterator<Item = Self>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = Self>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl<T: PrimStore, V: AsPrimitive<usize>, const N: usize> FromIterator<V> for BitSet<[T; N], V>
impl<T: PrimStore, V: AsPrimitive<usize>, const N: usize> FromIterator<V> for BitSet<[T; N], V>
Source§fn from_iter<I: IntoIterator<Item = V>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = V>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl<A: Copy + PrimStore, V: AsPrimitive<usize>> FromIterator<V> for BitSet<A, V>
impl<A: Copy + PrimStore, V: AsPrimitive<usize>> FromIterator<V> for BitSet<A, V>
Source§fn from_iter<T: IntoIterator<Item = V>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = V>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl<'a, T: PrimInt + BitAndAssign, V: TryFrom<usize>, const N: usize> IntoIterator for &'a BitSet<[T; N], V>
impl<'a, T: PrimInt + BitAndAssign, V: TryFrom<usize>, const N: usize> IntoIterator for &'a BitSet<[T; N], V>
Source§impl<'a, A: PrimStore + BitAndAssign, V: TryFrom<usize>> IntoIterator for &'a BitSet<A, V>
impl<'a, A: PrimStore + BitAndAssign, V: TryFrom<usize>> IntoIterator for &'a BitSet<A, V>
Source§impl<A, V> IntoIterator for BitSet<A, V>
impl<A, V> IntoIterator for BitSet<A, V>
Source§impl<A: PrimStore + Ord, V> Ord for BitSet<A, V>
impl<A: PrimStore + Ord, V> Ord for BitSet<A, V>
Source§impl<A: PrimStore + Ord, V> PartialOrd for BitSet<A, V>
impl<A: PrimStore + Ord, V> PartialOrd for BitSet<A, V>
Source§impl<T, V, const N: usize> SubAssign for BitSet<[T; N], V>
impl<T, V, const N: usize> SubAssign for BitSet<[T; N], V>
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreSource§impl<A, V> SubAssign for BitSet<A, V>
impl<A, V> SubAssign for BitSet<A, V>
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl<A: Copy, V: Copy> Copy for BitSet<A, V>
impl<T: Eq, V, const N: usize> Eq for BitSet<[T; N], V>
impl<A: PrimStore + Eq, V> Eq for BitSet<A, V>
Auto Trait Implementations§
impl<A, V> Freeze for BitSet<A, V>where
A: Freeze,
impl<A, V> RefUnwindSafe for BitSet<A, V>where
A: RefUnwindSafe,
V: RefUnwindSafe,
impl<A, V> Send for BitSet<A, V>
impl<A, V> Sync for BitSet<A, V>
impl<A, V> Unpin for BitSet<A, V>
impl<A, V> UnsafeUnpin for BitSet<A, V>where
A: UnsafeUnpin,
impl<A, V> UnwindSafe for BitSet<A, V>where
A: UnwindSafe,
V: 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