Struct amethyst::ecs::prelude::BitSet [−]
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
impl BitSetpub fn new() -> BitSet
pub fn new() -> BitSetCreates an empty BitSet.
pub fn with_capacity(max: u32) -> BitSet
pub fn with_capacity(max: u32) -> BitSetCreates an empty BitSet, preallocated for up to max indices.
pub fn add(&mut self, id: u32) -> bool
pub fn add(&mut self, id: u32) -> boolAdds id to the BitSet. Returns true if the value was
already in the set.
pub fn remove(&mut self, id: u32) -> bool
pub fn remove(&mut self, id: u32) -> boolRemoves id from the set, returns true if the value
was removed, and false if the value was not set
to begin with.
pub fn contains(&self, id: u32) -> bool
pub fn contains(&self, id: u32) -> boolReturns true if id is in the set.
pub fn clear(&mut self)
pub fn clear(&mut self)Completely wipes out the bit set.
Trait Implementations
impl ParJoin for BitSet
impl ParJoin for BitSetfn par_join(self) -> JoinParIter<Self>
fn par_join(self) -> JoinParIter<Self>Create a joined parallel iterator over the contents.
impl<'a> ParJoin for &'a BitSet
impl<'a> ParJoin for &'a BitSetfn par_join(self) -> JoinParIter<Self>
fn par_join(self) -> JoinParIter<Self>Create a joined parallel iterator over the contents.
impl<'a> Join for &'a BitSet
impl<'a> Join for &'a BitSettype Type = u32
Type of joined components.
type Value = ()
Type of joined storages.
type Mask = &'a BitSet
Type of joined bit mask.
fn open(self) -> (<&'a BitSet as Join>::Mask, <&'a BitSet as Join>::Value)
fn open(self) -> (<&'a BitSet as Join>::Mask, <&'a BitSet as Join>::Value)Open this join by returning the mask and the storages.
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>::TypeGet a joined component value by a given index.
ⓘImportant traits for JoinIter<J>fn join(self) -> JoinIter<Self>
fn join(self) -> JoinIter<Self>Create a joined iterator over the contents.
impl Join for BitSet
impl Join for BitSettype Type = u32
Type of joined components.
type Value = ()
Type of joined storages.
type Mask = BitSet
Type of joined bit mask.
fn open(self) -> (<BitSet as Join>::Mask, <BitSet as Join>::Value)
fn open(self) -> (<BitSet as Join>::Mask, <BitSet as Join>::Value)Open this join by returning the mask and the storages.
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>::TypeGet a joined component value by a given index.
ⓘImportant traits for JoinIter<J>fn join(self) -> JoinIter<Self>
fn join(self) -> JoinIter<Self>Create a joined iterator over the contents.
impl<T> BitXor<T> for BitSet where
T: BitSetLike,
impl<T> BitXor<T> for BitSet where
T: BitSetLike, type Output = BitSetXor<BitSet, T>
The resulting type after applying the ^ operator.
fn bitxor(self, rhs: T) -> <BitSet as BitXor<T>>::Output
fn bitxor(self, rhs: T) -> <BitSet as BitXor<T>>::OutputPerforms the ^ operation.
impl<'a, T> BitXor<T> for &'a BitSet where
T: BitSetLike,
impl<'a, T> BitXor<T> for &'a BitSet where
T: BitSetLike, type Output = BitSetXor<&'a BitSet, T>
The resulting type after applying the ^ operator.
fn bitxor(self, rhs: T) -> <&'a BitSet as BitXor<T>>::Output
fn bitxor(self, rhs: T) -> <&'a BitSet as BitXor<T>>::OutputPerforms the ^ operation.
impl<'a> IntoIterator for &'a BitSet
impl<'a> IntoIterator for &'a BitSettype Item = <BitIter<&'a BitSet> as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = BitIter<&'a BitSet>
Which kind of iterator are we turning this into?
fn into_iter(self) -> <&'a BitSet as IntoIterator>::IntoIter
fn into_iter(self) -> <&'a BitSet as IntoIterator>::IntoIterCreates an iterator from a value. Read more
impl IntoIterator for BitSet
impl IntoIterator for BitSettype Item = <BitIter<BitSet> as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = BitIter<BitSet>
Which kind of iterator are we turning this into?
fn into_iter(self) -> <BitSet as IntoIterator>::IntoIter
fn into_iter(self) -> <BitSet as IntoIterator>::IntoIterCreates an iterator from a value. Read more
impl<'a> FromIterator<&'a u32> for BitSet
impl<'a> FromIterator<&'a u32> for BitSetfn from_iter<T>(iter: T) -> BitSet where
T: IntoIterator<Item = &'a u32>,
fn from_iter<T>(iter: T) -> BitSet where
T: IntoIterator<Item = &'a u32>, Creates a value from an iterator. Read more
impl FromIterator<u32> for BitSet
impl FromIterator<u32> for BitSetfn from_iter<T>(iter: T) -> BitSet where
T: IntoIterator<Item = u32>,
fn from_iter<T>(iter: T) -> BitSet where
T: IntoIterator<Item = u32>, Creates a value from an iterator. Read more
impl<'a, B> BitXorAssign<&'a B> for BitSet where
B: BitSetLike,
impl<'a, B> BitXorAssign<&'a B> for BitSet where
B: BitSetLike, fn bitxor_assign(&mut self, lhs: &B)
fn bitxor_assign(&mut self, lhs: &B)Performs the ^= operation.
impl Not for BitSet
impl Not for BitSettype Output = BitSetNot<BitSet>
The resulting type after applying the ! operator.
fn not(self) -> <BitSet as Not>::Output
fn not(self) -> <BitSet as Not>::OutputPerforms the unary ! operation.
impl<'a> Not for &'a BitSet
impl<'a> Not for &'a BitSettype Output = BitSetNot<&'a BitSet>
The resulting type after applying the ! operator.
fn not(self) -> <&'a BitSet as Not>::Output
fn not(self) -> <&'a BitSet as Not>::OutputPerforms the unary ! operation.
impl<'a, B> BitOrAssign<&'a B> for BitSet where
B: BitSetLike,
impl<'a, B> BitOrAssign<&'a B> for BitSet where
B: BitSetLike, fn bitor_assign(&mut self, lhs: &B)
fn bitor_assign(&mut self, lhs: &B)Performs the |= operation.
impl Default for BitSet
impl Default for BitSetimpl BitSetLike for BitSet
impl BitSetLike for BitSetfn layer3(&self) -> usize
fn layer3(&self) -> usizeReturn a usize where each bit represents if any word in layer2 has been set. Read more
fn layer2(&self, i: usize) -> usize
fn layer2(&self, i: usize) -> usizeReturn 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
fn layer1(&self, i: usize) -> usizeReturn 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
fn layer0(&self, i: usize) -> usizeReturn a usize that maps to the direct 1:1 association with each index of the set Read more
fn contains(&self, i: u32) -> bool
fn contains(&self, i: u32) -> boolAllows checking if set bit is contained in the bit set.
fn get_from_layer(&self, layer: usize, idx: usize) -> usize
fn get_from_layer(&self, layer: usize, idx: usize) -> usizeGets the usize corresponding to layer and index. Read more
ⓘImportant traits for BitIter<T>fn iter(self) -> BitIter<Self>
fn iter(self) -> BitIter<Self>Create an iterator that will scan over the keyspace
fn par_iter(self) -> BitParIter<Self>
fn par_iter(self) -> BitParIter<Self>Create a parallel iterator that will scan over the keyspace
impl<'a, T> BitAnd<T> for &'a BitSet where
T: BitSetLike,
impl<'a, T> BitAnd<T> for &'a BitSet where
T: BitSetLike, type Output = BitSetAnd<&'a BitSet, T>
The resulting type after applying the & operator.
fn bitand(self, rhs: T) -> <&'a BitSet as BitAnd<T>>::Output
fn bitand(self, rhs: T) -> <&'a BitSet as BitAnd<T>>::OutputPerforms the & operation.
impl<T> BitAnd<T> for BitSet where
T: BitSetLike,
impl<T> BitAnd<T> for BitSet where
T: BitSetLike, type Output = BitSetAnd<BitSet, T>
The resulting type after applying the & operator.
fn bitand(self, rhs: T) -> <BitSet as BitAnd<T>>::Output
fn bitand(self, rhs: T) -> <BitSet as BitAnd<T>>::OutputPerforms the & operation.
impl<'a, B> BitAndAssign<&'a B> for BitSet where
B: BitSetLike,
impl<'a, B> BitAndAssign<&'a B> for BitSet where
B: BitSetLike, fn bitand_assign(&mut self, lhs: &B)
fn bitand_assign(&mut self, lhs: &B)Performs the &= operation.
impl<'a> Extend<&'a u32> for BitSet
impl<'a> Extend<&'a u32> for BitSetfn 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
impl Extend<u32> for BitSet
impl Extend<u32> for BitSetfn 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
impl<T> BitOr<T> for BitSet where
T: BitSetLike,
impl<T> BitOr<T> for BitSet where
T: BitSetLike, type Output = BitSetOr<BitSet, T>
The resulting type after applying the | operator.
fn bitor(self, rhs: T) -> <BitSet as BitOr<T>>::Output
fn bitor(self, rhs: T) -> <BitSet as BitOr<T>>::OutputPerforms the | operation.
impl<'a, T> BitOr<T> for &'a BitSet where
T: BitSetLike,
impl<'a, T> BitOr<T> for &'a BitSet where
T: BitSetLike, type Output = BitSetOr<&'a BitSet, T>
The resulting type after applying the | operator.
fn bitor(self, rhs: T) -> <&'a BitSet as BitOr<T>>::Output
fn bitor(self, rhs: T) -> <&'a BitSet as BitOr<T>>::OutputPerforms the | operation.
impl Clone for BitSet
impl Clone for BitSetfn clone(&self) -> BitSet
fn clone(&self) -> BitSetReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Debug for BitSet
impl Debug for BitSet