Skip to content

Commit

Permalink
feat: Impl QueryItem for UntypedComponentStore. (#416)
Browse files Browse the repository at this point in the history
Submitting on behalf of @TekhnaeRaav:

Minor tweak that allows you use untyped component stores in
`entities.iter_with()`.

Co-authored-by: Tekhnae Raav <tekhnaeraav@katharostech.com>
  • Loading branch information
zicklag and TekhnaeRaav committed Jun 21, 2024
1 parent 16cb7f2 commit 4fd57fe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions framework_crates/bones_ecs/src/entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@ where
OptionalQueryItemMut(component_ref, PhantomData)
}

impl<'a> QueryItem for &'a Ref<'a, UntypedComponentStore> {
type Iter = UntypedComponentBitsetIterator<'a>;
fn apply_bitset(&self, bitset: &mut BitSetVec) {
bitset.bit_and(self.bitset());
}

fn iter_with_bitset(self, bitset: Rc<BitSetVec>) -> Self::Iter {
UntypedComponentStore::iter_with_bitset(self, bitset)
}
}

impl<'a, 'q, T: HasSchema> QueryItem for &'a Comp<'q, T> {
type Iter = ComponentBitsetIterator<'a, T>;
fn apply_bitset(&self, bitset: &mut BitSetVec) {
Expand Down

0 comments on commit 4fd57fe

Please sign in to comment.