pub struct SparseBitset { /* private fields */ }Expand description
A set of instances that supports intersection and constant-time undo.
Words that become zero are moved out of the active part of
non_zero_words, so later operations only visit non-empty words.
Implementations§
Source§impl SparseBitset
impl SparseBitset
Sourcepub fn intersect_with(&mut self, other: &Bitset, invert: bool) -> usize
pub fn intersect_with(&mut self, other: &Bitset, invert: bool) -> usize
Intersects with other (with its complement when invert), saving the
current state for Self::restore. Returns the new size.
Sourcepub fn count_intersect_with(&self, other: &Bitset, invert: bool) -> usize
pub fn count_intersect_with(&self, other: &Bitset, invert: bool) -> usize
Size of the intersection with other (or its complement), without
changing the set.
Sourcepub fn count_intersect_with_many(&self, others: &[Bitset]) -> Vec<usize>
pub fn count_intersect_with_many(&self, others: &[Bitset]) -> Vec<usize>
Size of the intersection with each of others.
Sourcepub fn write_active_words(&self, out: &mut Vec<u64>)
pub fn write_active_words(&self, out: &mut Vec<u64>)
Writes every word of the set into out, with the inactive ones as 0.
A word that becomes empty is moved out of the active part of
non_zero_words without being overwritten, so its stored value is
stale and must not be read.
Trait Implementations§
Source§impl From<&SparseBitset> for ShallowBitset
impl From<&SparseBitset> for ShallowBitset
Source§fn from(val: &SparseBitset) -> Self
fn from(val: &SparseBitset) -> Self
Source§impl Sub<&ShallowBitset> for &SparseBitset
in_count counts the elements of self missing from rhs, and
out_count the elements of rhs missing from self.
impl Sub<&ShallowBitset> for &SparseBitset
in_count counts the elements of self missing from rhs, and
out_count the elements of rhs missing from self.
Source§type Output = Difference
type Output = Difference
- operator.Source§impl Sub<&ShallowBitset> for SparseBitset
impl Sub<&ShallowBitset> for SparseBitset
Source§type Output = Difference
type Output = Difference
- operator.Source§impl Sub<ShallowBitset> for SparseBitset
impl Sub<ShallowBitset> for SparseBitset
Source§type Output = Difference
type Output = Difference
- operator.Source§impl Sub<ShallowBitset> for &SparseBitset
impl Sub<ShallowBitset> for &SparseBitset
Source§type Output = Difference
type Output = Difference
- operator.