Trait bones_framework::lib::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§

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

fn bitset(&self) -> &BitSetVec

Get bitset of ComponentStore / implementor.

source

fn contains(&self, entity: Entity) -> bool

Check whether or not this component store has data for the given entity.

source

fn component_store(&self) -> &ComponentStore<T>

Get ComponentStore for usage with generic types implementing ComponentIterBitset.

Implementors§

source§

impl<'a, T> ComponentIterBitset<'a, T> for ComponentStore<T>
where T: HasSchema,