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
sourceimpl 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
sourceimpl<'a, T> BitAnd<T> for &'a BitSetwhere
T: BitSetLike,
impl<'a, T> BitAnd<T> for &'a BitSetwhere
T: BitSetLike,
sourceimpl<T> BitAnd<T> for BitSetwhere
T: BitSetLike,
impl<T> BitAnd<T> for BitSetwhere
T: BitSetLike,
sourceimpl<'a, B> BitAndAssign<&'a B> for BitSetwhere
B: BitSetLike,
impl<'a, B> BitAndAssign<&'a B> for BitSetwhere
B: BitSetLike,
sourcefn bitand_assign(&mut self, lhs: &B)
fn bitand_assign(&mut self, lhs: &B)
Performs the
&=
operation. Read moresourceimpl<'a, T> BitOr<T> for &'a BitSetwhere
T: BitSetLike,
impl<'a, T> BitOr<T> for &'a BitSetwhere
T: BitSetLike,
sourceimpl<T> BitOr<T> for BitSetwhere
T: BitSetLike,
impl<T> BitOr<T> for BitSetwhere
T: BitSetLike,
sourceimpl<'a, B> BitOrAssign<&'a B> for BitSetwhere
B: BitSetLike,
impl<'a, B> BitOrAssign<&'a B> for BitSetwhere
B: BitSetLike,
sourcefn bitor_assign(&mut self, lhs: &B)
fn bitor_assign(&mut self, lhs: &B)
Performs the
|=
operation. Read moresourceimpl BitSetLike for BitSet
impl BitSetLike for BitSet
sourcefn layer3(&self) -> usize
fn layer3(&self) -> usize
Return a
usize
where each bit represents if any word in layer2
has been set. Read moresourcefn 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 moresourcefn 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 moresourcefn 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 moresourcefn 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 moresourcefn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Returns true if this
BitSetLike
contains nothing, and false otherwise.sourcefn iter(self) -> BitIter<Self>where
Self: Sized,
fn iter(self) -> BitIter<Self>where
Self: Sized,
Create an iterator that will scan over the keyspace
sourcefn 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
sourceimpl<'a, T> BitXor<T> for &'a BitSetwhere
T: BitSetLike,
impl<'a, T> BitXor<T> for &'a BitSetwhere
T: BitSetLike,
sourceimpl<T> BitXor<T> for BitSetwhere
T: BitSetLike,
impl<T> BitXor<T> for BitSetwhere
T: BitSetLike,
sourceimpl<'a, B> BitXorAssign<&'a B> for BitSetwhere
B: BitSetLike,
impl<'a, B> BitXorAssign<&'a B> for BitSetwhere
B: BitSetLike,
sourcefn bitxor_assign(&mut self, lhs: &B)
fn bitxor_assign(&mut self, lhs: &B)
Performs the
^=
operation. Read moresourceimpl DrainableBitSet for BitSet
impl DrainableBitSet for BitSet
sourceimpl<'a> Extend<&'a u32> for BitSet
impl<'a> Extend<&'a u32> for BitSet
sourcefn 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
sourcefn 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.
sourcefn 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
sourceimpl Extend<u32> for BitSet
impl Extend<u32> for BitSet
sourcefn 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
sourcefn 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.
sourcefn 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
sourceimpl<'a> FromIterator<&'a u32> for BitSet
impl<'a> FromIterator<&'a u32> for BitSet
sourceimpl FromIterator<u32> for BitSet
impl FromIterator<u32> for BitSet
sourceimpl<'a> IntoIterator for &'a BitSet
impl<'a> IntoIterator for &'a BitSet
sourceimpl IntoIterator for BitSet
impl IntoIterator for BitSet
sourceimpl<'a> Join for &'a BitSet
impl<'a> Join for &'a BitSet
sourceunsafe fn open(self) -> (Self::Mask, Self::Value)
unsafe fn open(self) -> (Self::Mask, Self::Value)
Open this join by returning the mask and the storages. Read more
sourceunsafe fn get(_: &mut Self::Value, id: Index) -> Self::Type
unsafe fn get(_: &mut Self::Value, id: Index) -> Self::Type
Get a joined component value by a given index.
sourcefn join(self) -> JoinIter<Self>ⓘNotable traits for JoinIter<J>impl<J: Join> Iterator for JoinIter<J> type Item = J::Type;
where
Self: Sized,
fn join(self) -> JoinIter<Self>ⓘNotable traits for JoinIter<J>impl<J: Join> Iterator for JoinIter<J> type Item = J::Type;
where
Self: Sized,
Create a joined iterator over the contents.
sourcefn maybe(self) -> MaybeJoin<Self>where
Self: Sized,
fn maybe(self) -> MaybeJoin<Self>where
Self: Sized,
Returns a
Join
-able structure that yields all indices, returning None
for all
missing elements and Some(T)
for found elements. Read moresourcefn is_unconstrained() -> bool
fn is_unconstrained() -> bool
If this
Join
typically returns all indices in the mask, then iterating over only it
or combined with other joins that are also dangerous will cause the JoinIter
/ParJoin
to
go through all indices which is usually not what is wanted and will kill performance. Read moresourceimpl Join for BitSet
impl Join for BitSet
sourceunsafe fn open(self) -> (Self::Mask, Self::Value)
unsafe fn open(self) -> (Self::Mask, Self::Value)
Open this join by returning the mask and the storages. Read more
sourceunsafe fn get(_: &mut Self::Value, id: Index) -> Self::Type
unsafe fn get(_: &mut Self::Value, id: Index) -> Self::Type
Get a joined component value by a given index.
sourcefn join(self) -> JoinIter<Self>ⓘNotable traits for JoinIter<J>impl<J: Join> Iterator for JoinIter<J> type Item = J::Type;
where
Self: Sized,
fn join(self) -> JoinIter<Self>ⓘNotable traits for JoinIter<J>impl<J: Join> Iterator for JoinIter<J> type Item = J::Type;
where
Self: Sized,
Create a joined iterator over the contents.
sourcefn maybe(self) -> MaybeJoin<Self>where
Self: Sized,
fn maybe(self) -> MaybeJoin<Self>where
Self: Sized,
Returns a
Join
-able structure that yields all indices, returning None
for all
missing elements and Some(T)
for found elements. Read moresourcefn is_unconstrained() -> bool
fn is_unconstrained() -> bool
If this
Join
typically returns all indices in the mask, then iterating over only it
or combined with other joins that are also dangerous will cause the JoinIter
/ParJoin
to
go through all indices which is usually not what is wanted and will kill performance. Read moreAuto Trait Implementations
impl RefUnwindSafe for BitSet
impl Send for BitSet
impl Sync for BitSet
impl Unpin for BitSet
impl UnwindSafe for BitSet
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> TryDefault for Twhere
T: Default,
impl<T> TryDefault for Twhere
T: Default,
sourcefn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
Tries to create the default.
sourcefn unwrap_default() -> Self
fn unwrap_default() -> Self
Calls
try_default
and panics on an error case.