Trait bones_framework::prelude::ComponentIterBitset
source · pub trait ComponentIterBitset<'a, T>where
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>,
) -> Map<UntypedComponentBitsetIterator<'_>, for<'b> fn(_: SchemaRef<'b>) -> &'b T> ⓘ;
fn iter_with_bitset_optional(
&self,
bitset: Rc<BitSetVec>,
) -> Map<UntypedComponentOptionalBitsetIterator<'_>, for<'b> fn(_: Option<SchemaRef<'b>>) -> Option<&'b T>> ⓘ;
fn iter_mut_with_bitset(
&mut self,
bitset: Rc<BitSetVec>,
) -> Map<UntypedComponentBitsetIteratorMut<'_>, for<'b> fn(_: SchemaRefMut<'b>) -> &'b mut T> ⓘ;
fn iter_mut_with_bitset_optional(
&mut self,
bitset: Rc<BitSetVec>,
) -> Map<UntypedComponentOptionalBitsetIteratorMut<'_>, for<'b> fn(_: Option<SchemaRefMut<'b>>) -> Option<&'b mut 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>,
) -> Map<UntypedComponentBitsetIterator<'_>, for<'b> fn(_: SchemaRef<'b>) -> &'b T> ⓘ
fn iter_with_bitset( &self, bitset: Rc<BitSetVec>, ) -> Map<UntypedComponentBitsetIterator<'_>, for<'b> fn(_: SchemaRef<'b>) -> &'b 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>,
) -> Map<UntypedComponentOptionalBitsetIterator<'_>, for<'b> fn(_: Option<SchemaRef<'b>>) -> Option<&'b T>> ⓘ
fn iter_with_bitset_optional( &self, bitset: Rc<BitSetVec>, ) -> Map<UntypedComponentOptionalBitsetIterator<'_>, for<'b> fn(_: Option<SchemaRef<'b>>) -> Option<&'b 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>,
) -> Map<UntypedComponentBitsetIteratorMut<'_>, for<'b> fn(_: SchemaRefMut<'b>) -> &'b mut T> ⓘ
fn iter_mut_with_bitset( &mut self, bitset: Rc<BitSetVec>, ) -> Map<UntypedComponentBitsetIteratorMut<'_>, for<'b> fn(_: SchemaRefMut<'b>) -> &'b mut 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>,
) -> Map<UntypedComponentOptionalBitsetIteratorMut<'_>, for<'b> fn(_: Option<SchemaRefMut<'b>>) -> Option<&'b mut T>> ⓘ
fn iter_mut_with_bitset_optional( &mut self, bitset: Rc<BitSetVec>, ) -> Map<UntypedComponentOptionalBitsetIteratorMut<'_>, for<'b> fn(_: Option<SchemaRefMut<'b>>) -> Option<&'b mut 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
.