Struct staticbitset::StaticBitSet
source · [−]pub struct StaticBitSet<const N: usize> { /* private fields */ }
Implementations
sourceimpl<const N: usize> StaticBitSet<N>
impl<const N: usize> StaticBitSet<N>
pub fn remove(&mut self, bit: usize)
pub fn set(&mut self, bit: usize, enabled: bool)
pub fn contains(&self, bit: usize) -> bool
pub fn ones(&self) -> OnesIter<'_>ⓘNotable traits for OnesIter<'a>impl<'a> Iterator for OnesIter<'a> type Item = usize;
sourcepub fn count_ones(&self) -> BlockElt
pub fn count_ones(&self) -> BlockElt
Returns the number of elements in the set.
sourcepub fn count_zeros(&self) -> BlockElt
pub fn count_zeros(&self) -> BlockElt
Returns the number of elements missing from the set.
sourcepub fn is_subset(&self, other: &Self) -> bool
pub fn is_subset(&self, other: &Self) -> bool
Returns true
if the set is a subset of another, i.e. other
contains at least all the values in self
.
sourcepub fn is_superset(&self, other: &Self) -> bool
pub fn is_superset(&self, other: &Self) -> bool
Returns true
if the set is a subset of another, i.e. self
contains at least all the values in other
.
sourcepub fn is_disjoint(&self, other: &Self) -> bool
pub fn is_disjoint(&self, other: &Self) -> bool
Returns true
if self
has no elements in common with other. This is
equivalent to checking for an empty intersection.
sourcepub fn union(&self, other: &Self, union: &mut Self)
pub fn union(&self, other: &Self, union: &mut Self)
Populates the union, i.e. all the values in self
or other
, without duplicates.
use staticbitset::StaticBitSet;
let mut a = StaticBitSet::<64>::default();
let mut b = StaticBitSet::<64>::default();
let mut c = StaticBitSet::<64>::default();
a.insert(3);
a.insert(2);
b.insert(1);
b.insert(4);
a.union(&b, &mut c);
assert_eq!(c.ones().collect::<Vec<usize>>(), [1,2,3,4]);
Trait Implementations
sourceimpl<const N: usize> Clone for StaticBitSet<N>
impl<const N: usize> Clone for StaticBitSet<N>
sourcefn clone(&self) -> StaticBitSet<N>
fn clone(&self) -> StaticBitSet<N>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<const N: usize> Debug for StaticBitSet<N>
impl<const N: usize> Debug for StaticBitSet<N>
sourceimpl<const N: usize> Default for StaticBitSet<N>
impl<const N: usize> Default for StaticBitSet<N>
sourceimpl<const N: usize> Hash for StaticBitSet<N>
impl<const N: usize> Hash for StaticBitSet<N>
sourceimpl<const N: usize> PartialEq<StaticBitSet<N>> for StaticBitSet<N>
impl<const N: usize> PartialEq<StaticBitSet<N>> for StaticBitSet<N>
sourcefn eq(&self, other: &StaticBitSet<N>) -> bool
fn eq(&self, other: &StaticBitSet<N>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &StaticBitSet<N>) -> bool
fn ne(&self, other: &StaticBitSet<N>) -> bool
This method tests for !=
.
impl<const N: usize> Copy for StaticBitSet<N>
impl<const N: usize> Eq for StaticBitSet<N>
impl<const N: usize> StructuralEq for StaticBitSet<N>
impl<const N: usize> StructuralPartialEq for StaticBitSet<N>
Auto Trait Implementations
impl<const N: usize> RefUnwindSafe for StaticBitSet<N>
impl<const N: usize> Send for StaticBitSet<N>
impl<const N: usize> Sync for StaticBitSet<N>
impl<const N: usize> Unpin for StaticBitSet<N>
impl<const N: usize> UnwindSafe for StaticBitSet<N>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more