Struct smallbitset::Set8
source · pub struct Set8 { /* 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 Set8
impl Set8
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<Set8> for Set8
impl BitAndAssign<Set8> for Set8
source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&=
operation. Read moresource§impl BitOrAssign<Set8> for Set8
impl BitOrAssign<Set8> for Set8
source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|=
operation. Read moresource§impl BitXorAssign<Set8> for Set8
impl BitXorAssign<Set8> for Set8
source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
^=
operation. Read moresource§impl Ord for Set8
impl Ord for Set8
source§impl PartialEq<Set8> for Set8
impl PartialEq<Set8> for Set8
source§impl PartialOrd<Set8> for Set8
impl PartialOrd<Set8> for Set8
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more