pub struct BitSet { /* private fields */ }
Expand description
A BitSet
is a simple set designed to track which indices are placed
into it.
Note, a BitSet
is limited by design to only usize**4
indices.
Adding beyond this limit will cause the BitSet
to panic.
Implementations§
source§impl BitSet
impl BitSet
sourcepub fn with_capacity(max: u32) -> BitSet
pub fn with_capacity(max: u32) -> BitSet
Creates an empty BitSet
, preallocated for up to max
indices.
sourcepub fn add(&mut self, id: u32) -> bool
pub fn add(&mut self, id: u32) -> bool
Adds id
to the BitSet
. Returns true
if the value was
already in the set.
Trait Implementations§
source§impl<'a, T> BitAnd<T> for &'a BitSetwhere
T: BitSetLike,
impl<'a, T> BitAnd<T> for &'a BitSetwhere
T: BitSetLike,
source§impl<T> BitAnd<T> for BitSetwhere
T: BitSetLike,
impl<T> BitAnd<T> for BitSetwhere
T: BitSetLike,
source§impl<'a, B> BitAndAssign<&'a B> for BitSetwhere
B: BitSetLike,
impl<'a, B> BitAndAssign<&'a B> for BitSetwhere
B: BitSetLike,
source§fn bitand_assign(&mut self, lhs: &B)
fn bitand_assign(&mut self, lhs: &B)
Performs the
&=
operation. Read moresource§impl<'a, T> BitOr<T> for &'a BitSetwhere
T: BitSetLike,
impl<'a, T> BitOr<T> for &'a BitSetwhere
T: BitSetLike,
source§impl<T> BitOr<T> for BitSetwhere
T: BitSetLike,
impl<T> BitOr<T> for BitSetwhere
T: BitSetLike,
source§impl<'a, B> BitOrAssign<&'a B> for BitSetwhere
B: BitSetLike,
impl<'a, B> BitOrAssign<&'a B> for BitSetwhere
B: BitSetLike,
source§fn bitor_assign(&mut self, lhs: &B)
fn bitor_assign(&mut self, lhs: &B)
Performs the
|=
operation. Read moresource§impl BitSetLike for BitSet
impl BitSetLike for BitSet
source§fn layer3(&self) -> usize
fn layer3(&self) -> usize
Return a
usize
where each bit represents if any word in layer2
has been set. Read moresource§fn layer2(&self, i: usize) -> usize
fn layer2(&self, i: usize) -> usize
Return the
usize
from the array of usizes that indicates if any
bit has been set in layer1 Read moresource§fn layer1(&self, i: usize) -> usize
fn layer1(&self, i: usize) -> usize
Return the
usize
from the array of usizes that indicates if any
bit has been set in layer0 Read moresource§fn layer0(&self, i: usize) -> usize
fn layer0(&self, i: usize) -> usize
Return a
usize
that maps to the direct 1:1 association with
each index of the set Read moresource§fn get_from_layer(&self, layer: usize, idx: usize) -> usize
fn get_from_layer(&self, layer: usize, idx: usize) -> usize
Gets the
usize
corresponding to layer and index. Read moresource§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Returns true if this
BitSetLike
contains nothing, and false otherwise.source§fn iter(self) -> BitIter<Self> ⓘwhere
Self: Sized,
fn iter(self) -> BitIter<Self> ⓘwhere
Self: Sized,
Create an iterator that will scan over the keyspace
source§fn par_iter(self) -> BitParIter<Self>where
Self: Sized,
fn par_iter(self) -> BitParIter<Self>where
Self: Sized,
Create a parallel iterator that will scan over the keyspace
source§impl<'a, T> BitXor<T> for &'a BitSetwhere
T: BitSetLike,
impl<'a, T> BitXor<T> for &'a BitSetwhere
T: BitSetLike,
source§impl<T> BitXor<T> for BitSetwhere
T: BitSetLike,
impl<T> BitXor<T> for BitSetwhere
T: BitSetLike,
source§impl<'a, B> BitXorAssign<&'a B> for BitSetwhere
B: BitSetLike,
impl<'a, B> BitXorAssign<&'a B> for BitSetwhere
B: BitSetLike,
source§fn bitxor_assign(&mut self, lhs: &B)
fn bitxor_assign(&mut self, lhs: &B)
Performs the
^=
operation. Read moresource§impl DrainableBitSet for BitSet
impl DrainableBitSet for BitSet
source§impl<'a> Extend<&'a u32> for BitSet
impl<'a> Extend<&'a u32> for BitSet
source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = &'a u32>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = &'a u32>,
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl Extend<u32> for BitSet
impl Extend<u32> for BitSet
source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = u32>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = u32>,
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more