pub struct BitSet<const N: usize>(/* private fields */);Expand description
Array based bitset implementation. N gives the size in Bytes of the bucket
Implementations§
Source§impl<const N: usize> BitSet<N>
impl<const N: usize> BitSet<N>
Sourcepub fn set_nth_bit(&mut self, index: usize) -> bool
pub fn set_nth_bit(&mut self, index: usize) -> bool
Sourcepub fn unset_nth_bit(&mut self, index: usize) -> bool
pub fn unset_nth_bit(&mut self, index: usize) -> bool
Sourcepub fn get_nth_bit(&self, index: usize) -> bool
pub fn get_nth_bit(&self, index: usize) -> bool
pub fn as_slice(&self) -> &[u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Sourcepub fn count_ones(&self) -> usize
pub fn count_ones(&self) -> usize
Counts bits to one in the current set
Sourcepub fn intersection(&mut self, other: &Self)
pub fn intersection(&mut self, other: &Self)
Make the intersection of the current set with another one
Sourcepub const fn count_ones_in_common(&self, other: &Self) -> usize
pub const fn count_ones_in_common(&self, other: &Self) -> usize
Count bits to one in common between two sets
Sourcepub fn count_zeros(&self) -> usize
pub fn count_zeros(&self) -> usize
Counts bits to zero in the current set
Trait Implementations§
Auto Trait Implementations§
impl<const N: usize> Freeze for BitSet<N>
impl<const N: usize> RefUnwindSafe for BitSet<N>
impl<const N: usize> Send for BitSet<N>
impl<const N: usize> Sync for BitSet<N>
impl<const N: usize> Unpin for BitSet<N>
impl<const N: usize> UnwindSafe for BitSet<N>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.