Struct hibitset::BitSet
[−]
[src]
pub struct BitSet { /* fields omitted */ }
A BitSet
is a simple set designed to track entity indices for which
a certain component exists. It does not track the Generation
of the
entities that it contains.
Note, a BitSet
is limited by design to only 1,048,576
indices.
Adding beyond this limit will cause the BitSet
to panic.
Methods
impl BitSet
[src]
fn new() -> BitSet
[src]
Creates an empty BitSet
.
fn with_capacity(max: u32) -> BitSet
[src]
Creates an empty BitSet
, preallocated for up to max
indices.
fn add(&mut self, id: u32) -> bool
[src]
Adds id
to the BitSet
. Returns true
if the value was
already in the set.
fn remove(&mut self, id: u32) -> bool
[src]
Removes id
from the set, returns true
if the value
was removed, and false
if the value was not set
to begin with.
fn contains(&self, id: u32) -> bool
[src]
Returns true
if id
is in the set.
fn clear(&mut self)
[src]
Completely wipes out the bit set.
Trait Implementations
impl IntoIterator for BitSet
[src]
type Item = <BitIter<Self> as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = BitIter<Self>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl Not for BitSet
[src]
type Output = BitSetNot<Self>
The resulting type after applying the !
operator.
fn not(self) -> Self::Output
[src]
Performs the unary !
operation.
impl<T> BitAnd<T> for BitSet where
T: BitSetLike,
[src]
T: BitSetLike,
type Output = BitSetAnd<Self, T>
The resulting type after applying the &
operator.
fn bitand(self, rhs: T) -> Self::Output
[src]
Performs the &
operation.
impl<T> BitOr<T> for BitSet where
T: BitSetLike,
[src]
T: BitSetLike,
type Output = BitSetOr<Self, T>
The resulting type after applying the |
operator.
fn bitor(self, rhs: T) -> Self::Output
[src]
Performs the |
operation.
impl<T> BitXor<T> for BitSet where
T: BitSetLike,
[src]
T: BitSetLike,
type Output = BitSetXor<Self, T>
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: T) -> Self::Output
[src]
Performs the ^
operation.
impl<'a> IntoIterator for &'a BitSet
[src]
type Item = <BitIter<Self> as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = BitIter<Self>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
Creates an iterator from a value. Read more
impl<'a> Not for &'a BitSet
[src]
type Output = BitSetNot<Self>
The resulting type after applying the !
operator.
fn not(self) -> Self::Output
[src]
Performs the unary !
operation.
impl<'a, T> BitAnd<T> for &'a BitSet where
T: BitSetLike,
[src]
T: BitSetLike,
type Output = BitSetAnd<Self, T>
The resulting type after applying the &
operator.
fn bitand(self, rhs: T) -> Self::Output
[src]
Performs the &
operation.
impl<'a, T> BitOr<T> for &'a BitSet where
T: BitSetLike,
[src]
T: BitSetLike,
type Output = BitSetOr<Self, T>
The resulting type after applying the |
operator.
fn bitor(self, rhs: T) -> Self::Output
[src]
Performs the |
operation.
impl<'a, T> BitXor<T> for &'a BitSet where
T: BitSetLike,
[src]
T: BitSetLike,
type Output = BitSetXor<Self, T>
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: T) -> Self::Output
[src]
Performs the ^
operation.
impl FromIterator<u32> for BitSet
[src]
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = u32>,
[src]
T: IntoIterator<Item = u32>,
Creates a value from an iterator. Read more
impl<'a> FromIterator<&'a u32> for BitSet
[src]
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = &'a u32>,
[src]
T: IntoIterator<Item = &'a u32>,
Creates a value from an iterator. Read more
impl Extend<u32> for BitSet
[src]
fn extend<T>(&mut self, iter: T) where
T: IntoIterator<Item = u32>,
[src]
T: IntoIterator<Item = u32>,
Extends a collection with the contents of an iterator. Read more
impl<'a> Extend<&'a u32> for BitSet
[src]
fn extend<T>(&mut self, iter: T) where
T: IntoIterator<Item = &'a u32>,
[src]
T: IntoIterator<Item = &'a u32>,
Extends a collection with the contents of an iterator. Read more
impl Clone for BitSet
[src]
fn clone(&self) -> BitSet
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for BitSet
[src]
impl Default for BitSet
[src]
impl BitSetLike for BitSet
[src]
fn layer3(&self) -> usize
[src]
Return a usize where each bit represents if any word in layer2 has been set. Read more
fn layer2(&self, i: usize) -> usize
[src]
Return the usize from the array of usizes that indicates if any bit has been set in layer1 Read more
fn layer1(&self, i: usize) -> usize
[src]
Return the usize from the array of usizes that indicates if any bit has been set in layer0 Read more
fn layer0(&self, i: usize) -> usize
[src]
Return a usize that maps to the direct 1:1 association with each index of the set Read more
fn contains(&self, i: u32) -> bool
[src]
Allows checking if set bit is contained in the bit set.
fn iter(self) -> BitIter<Self> where
Self: Sized,
[src]
Self: Sized,
Create an iterator that will scan over the keyspace
fn par_iter(self) -> BitParIter<Self> where
Self: Sized,
[src]
Self: Sized,
Create a parallel iterator that will scan over the keyspace