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.
Sourcepub fn remove(&mut self, id: u32) -> bool
pub fn remove(&mut self, id: u32) -> bool
Removes id from the set, returns true if the value
was removed, and false if the value was not set
to begin with.
Sourcepub fn contains_set(&self, other: &BitSet) -> bool
pub fn contains_set(&self, other: &BitSet) -> bool
Returns true if all ids in other are contained in this 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, 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 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.Source§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 layer1Source§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 layer0Source§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 setSource§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 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
Source§impl<'a> FromIterator<&'a u32> for BitSet
impl<'a> FromIterator<&'a u32> for BitSet
Source§impl FromIterator<u32> for BitSet
impl FromIterator<u32> for BitSet
Source§impl<'a> IntoIterator for &'a BitSet
impl<'a> IntoIterator for &'a BitSet
Source§impl IntoIterator for BitSet
impl IntoIterator for BitSet
impl Eq for BitSet
Auto Trait Implementations§
impl Freeze for BitSet
impl RefUnwindSafe for BitSet
impl Send for BitSet
impl Sync for BitSet
impl Unpin for BitSet
impl UnwindSafe for BitSet
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more