pub struct Set32 { /* private fields */ }
Expand description
This structure implemts a bitset with a maximum capacity of $capa bits. The structure requires no dynamic allocation and it is therefore fully copiable
Implementations§
Source§impl Set32
impl Set32
Sourcepub fn len(self) -> usize
pub fn len(self) -> usize
Returns the lenght of the set. That is the number of itemes present (value of the bit is 1) in the set
Sourcepub fn add_inplace(&mut self, x: usize) -> &mut Self
pub fn add_inplace(&mut self, x: usize) -> &mut Self
Adds the item x to this set
Sourcepub const fn remove(self, x: usize) -> Self
pub const fn remove(self, x: usize) -> Self
Returns a new set where item x is absent from the set
Sourcepub fn remove_inplace(&mut self, x: usize) -> &mut Self
pub fn remove_inplace(&mut self, x: usize) -> &mut Self
Removes x from the current set
Sourcepub fn union_inplace(&mut self, other: &Self) -> &mut Self
pub fn union_inplace(&mut self, other: &Self) -> &mut Self
Updates this set so that it contains the union of self and other
Sourcepub fn inter_inplace(&mut self, other: &Self) -> &mut Self
pub fn inter_inplace(&mut self, other: &Self) -> &mut Self
Updates this set so that it contains the intersection of self and other
Sourcepub fn diff_inplace(&mut self, other: &Self) -> &mut Self
pub fn diff_inplace(&mut self, other: &Self) -> &mut Self
Updates this set so that it contains the difference of self and other
Sourcepub fn symmetric_difference(self, other: Self) -> Self
pub fn symmetric_difference(self, other: Self) -> Self
Returns a set which is the exclusive or of the two sets
Sourcepub fn symmetric_difference_inplace(&mut self, other: &Self) -> &mut Self
pub fn symmetric_difference_inplace(&mut self, other: &Self) -> &mut Self
Updates this set so that it contains the exclusive or of self and other
Sourcepub fn flip(self) -> Self
pub fn flip(self) -> Self
Flips all the bits of self (all members are removed, all absent are added)
Sourcepub fn flip_inplace(&mut self) -> &mut Self
pub fn flip_inplace(&mut self) -> &mut Self
Updates this set so that it contains the negation of self
Sourcepub fn contains_all(self, other: Self) -> bool
pub fn contains_all(self, other: Self) -> bool
Returns true iff this set contains all the elements of the other set. (self is a superset of other).
Sourcepub fn intersects(&self, other: Self) -> bool
pub fn intersects(&self, other: Self) -> bool
Returns true iff the intersects with other set
Sourcepub fn iter(&self) -> impl Iterator<Item = usize> + '_
pub fn iter(&self) -> impl Iterator<Item = usize> + '_
Returns an iterator that goes over all the items present in this set
Sourcepub fn ones(&self) -> impl Iterator<Item = usize> + '_
pub fn ones(&self) -> impl Iterator<Item = usize> + '_
Returns an iterator that goes over all the items present in this set
Sourcepub fn zeroes(&self) -> impl Iterator<Item = usize> + '_
pub fn zeroes(&self) -> impl Iterator<Item = usize> + '_
Returns an iterator that goes over all the items absent from this set
Sourcepub fn subsets(&self, of_size: usize) -> impl Iterator<Item = Self> + '_
pub fn subsets(&self, of_size: usize) -> impl Iterator<Item = Self> + '_
Returns an iterator that goes over all the items absent from this set
Requires the alloc
feature
Sourcepub const fn inc(self) -> Self
pub const fn inc(self) -> Self
Returns the next value when considering the bitset as a large integer value and incrementing it by one.
Sourcepub fn inc_inplace(&mut self) -> &mut Self
pub fn inc_inplace(&mut self) -> &mut Self
Consider the bitset as a large integer value and increments it by one
Trait Implementations§
Source§impl BitAndAssign for Set32
impl BitAndAssign for Set32
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&=
operation. Read moreSource§impl BitOrAssign for Set32
impl BitOrAssign for Set32
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|=
operation. Read moreSource§impl BitXorAssign for Set32
impl BitXorAssign for Set32
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
^=
operation. Read more