Trait bones_ecs::components::ComponentIterBitset
source · pub trait ComponentIterBitset<'a, T: HasSchema> {
// Required methods
fn get_single_with_bitset(
&self,
bitset: Rc<BitSetVec>,
) -> Result<&T, QuerySingleError>;
fn get_single_mut_with_bitset(
&mut self,
bitset: Rc<BitSetVec>,
) -> Result<&mut T, QuerySingleError>;
fn iter_with_bitset(
&self,
bitset: Rc<BitSetVec>,
) -> ComponentBitsetIterator<'_, T>;
fn iter_with_bitset_optional(
&self,
bitset: Rc<BitSetVec>,
) -> ComponentBitsetOptionalIterator<'_, T>;
fn iter_mut_with_bitset(
&mut self,
bitset: Rc<BitSetVec>,
) -> ComponentBitsetIteratorMut<'_, T>;
fn iter_mut_with_bitset_optional(
&mut self,
bitset: Rc<BitSetVec>,
) -> ComponentBitsetOptionalIteratorMut<'_, T>;
fn bitset(&self) -> &BitSetVec;
fn contains(&self, entity: Entity) -> bool;
fn component_store(&self) -> &ComponentStore<T>;
}
Expand description
This trait factors out functions for iterating with bitset over component store.
Separated from impl ComponentStore
for usage in generic trait types that must
be able to create ComponentBitsetIterator
and related types.
Automatically implemented for ComponentStore
.
Required Methods§
sourcefn get_single_with_bitset(
&self,
bitset: Rc<BitSetVec>,
) -> Result<&T, QuerySingleError>
fn get_single_with_bitset( &self, bitset: Rc<BitSetVec>, ) -> Result<&T, QuerySingleError>
Gets an immutable reference to the component if there is exactly one instance of it.
sourcefn get_single_mut_with_bitset(
&mut self,
bitset: Rc<BitSetVec>,
) -> Result<&mut T, QuerySingleError>
fn get_single_mut_with_bitset( &mut self, bitset: Rc<BitSetVec>, ) -> Result<&mut T, QuerySingleError>
Gets a mutable reference to the component if there is exactly one instance of it.
sourcefn iter_with_bitset(
&self,
bitset: Rc<BitSetVec>,
) -> ComponentBitsetIterator<'_, T>
fn iter_with_bitset( &self, bitset: Rc<BitSetVec>, ) -> ComponentBitsetIterator<'_, T>
Iterates immutably over the components of this type where bitset
indicates the indices of entities.
Slower than iter()
but allows joining between multiple component types.
sourcefn iter_with_bitset_optional(
&self,
bitset: Rc<BitSetVec>,
) -> ComponentBitsetOptionalIterator<'_, T>
fn iter_with_bitset_optional( &self, bitset: Rc<BitSetVec>, ) -> ComponentBitsetOptionalIterator<'_, T>
Iterates immutably over the components of this type where bitset
indicates the indices of entities.
Slower than iter()
but allows joining between multiple component types.
sourcefn iter_mut_with_bitset(
&mut self,
bitset: Rc<BitSetVec>,
) -> ComponentBitsetIteratorMut<'_, T>
fn iter_mut_with_bitset( &mut self, bitset: Rc<BitSetVec>, ) -> ComponentBitsetIteratorMut<'_, T>
Iterates mutable over the components of this type where bitset
indicates the indices of entities.
Slower than iter()
but allows joining between multiple component types.
sourcefn iter_mut_with_bitset_optional(
&mut self,
bitset: Rc<BitSetVec>,
) -> ComponentBitsetOptionalIteratorMut<'_, T>
fn iter_mut_with_bitset_optional( &mut self, bitset: Rc<BitSetVec>, ) -> ComponentBitsetOptionalIteratorMut<'_, T>
Iterates mutably over the components of this type where bitset
indicates the indices of entities.
Slower than iter()
but allows joining between multiple component types.
sourcefn bitset(&self) -> &BitSetVec
fn bitset(&self) -> &BitSetVec
Get bitset of ComponentStore
/ implementor.
sourcefn contains(&self, entity: Entity) -> bool
fn contains(&self, entity: Entity) -> bool
Check whether or not this component store has data for the given entity.
sourcefn component_store(&self) -> &ComponentStore<T>
fn component_store(&self) -> &ComponentStore<T>
Get ComponentStore
for usage with generic types implementing ComponentIterBitset
.