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.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§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
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
Source§impl<'a> Join for &'a BitSet
impl<'a> Join for &'a BitSet
Source§unsafe fn open(
self,
) -> (<&'a BitSet as Join>::Mask, <&'a BitSet as Join>::Value)
unsafe fn open( self, ) -> (<&'a BitSet as Join>::Mask, <&'a BitSet as Join>::Value)
Open this join by returning the mask and the storages. Read more
Source§unsafe fn get(
_: &mut <&'a BitSet as Join>::Value,
id: u32,
) -> <&'a BitSet as Join>::Type
unsafe fn get( _: &mut <&'a BitSet as Join>::Value, id: u32, ) -> <&'a BitSet as Join>::Type
Get a joined component value by a given index.
Source§fn join(self) -> JoinIter<Self> ⓘwhere
Self: Sized,
fn join(self) -> JoinIter<Self> ⓘwhere
Self: Sized,
Create a joined iterator over the contents.
Source§fn 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 moreSource§fn 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.Source§impl Join for BitSet
impl Join for BitSet
Source§unsafe fn open(self) -> (<BitSet as Join>::Mask, <BitSet as Join>::Value)
unsafe fn open(self) -> (<BitSet as Join>::Mask, <BitSet as Join>::Value)
Open this join by returning the mask and the storages. Read more
Source§unsafe fn get(
_: &mut <BitSet as Join>::Value,
id: u32,
) -> <BitSet as Join>::Type
unsafe fn get( _: &mut <BitSet as Join>::Value, id: u32, ) -> <BitSet as Join>::Type
Get a joined component value by a given index.
Source§fn join(self) -> JoinIter<Self> ⓘwhere
Self: Sized,
fn join(self) -> JoinIter<Self> ⓘwhere
Self: Sized,
Create a joined iterator over the contents.
Source§fn 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 moreSource§fn 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.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> TryDefault for Twhere
T: Default,
impl<T> TryDefault for Twhere
T: Default,
Source§fn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
Tries to create the default.
Source§fn unwrap_default() -> Self
fn unwrap_default() -> Self
Calls
try_default and panics on an error case.