summaryrefslogtreecommitdiff
path: root/engine-ecs/src/query/flexible.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-07-23 17:38:51 +0200
committerHampusM <hampus@hampusmat.com>2026-07-23 17:38:51 +0200
commit624e6dd450944e67d84ad7afda54ae2abd277aba (patch)
tree908834c4d666eaf6b5f1fd3670e4951d98af1efe /engine-ecs/src/query/flexible.rs
parent66cbb5d207094799740228c4c913218ddca3a19d (diff)
refactor(engine-ecs): remove distinction between query terms with & without a field
Diffstat (limited to 'engine-ecs/src/query/flexible.rs')
-rw-r--r--engine-ecs/src/query/flexible.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/engine-ecs/src/query/flexible.rs b/engine-ecs/src/query/flexible.rs
index 66d62c6..fd1e30e 100644
--- a/engine-ecs/src/query/flexible.rs
+++ b/engine-ecs/src/query/flexible.rs
@@ -19,7 +19,7 @@ impl<'world, const MAX_TERM_CNT: usize> Query<'world, MAX_TERM_CNT>
{
/// Iterates over the entities matching this query.
#[must_use]
- pub fn iter(&self) -> Iter<'_>
+ pub fn iter(&self) -> Iter<'_, 'world>
{
Iter {
iter: self
@@ -52,10 +52,10 @@ impl<'world, const MAX_TERM_CNT: usize> Query<'world, MAX_TERM_CNT>
}
}
-impl<'query, const MAX_TERM_CNT: usize> IntoIterator for &'query Query<'_, MAX_TERM_CNT>
+impl<'query, 'world, const MAX_TERM_CNT: usize> IntoIterator for &'query Query<'world, MAX_TERM_CNT>
{
- type IntoIter = Iter<'query>;
- type Item = EntityHandle<'query>;
+ type IntoIter = Iter<'query, 'world>;
+ type Item = EntityHandle<'world>;
fn into_iter(self) -> Self::IntoIter
{
@@ -63,15 +63,15 @@ impl<'query, const MAX_TERM_CNT: usize> IntoIterator for &'query Query<'_, MAX_T
}
}
-pub struct Iter<'query>
+pub struct Iter<'query, 'world>
{
- iter: QueryEntityIter<'query>,
- world: &'query World,
+ iter: QueryEntityIter<'query, 'world>,
+ world: &'world World,
}
-impl<'query> Iterator for Iter<'query>
+impl<'query, 'world> Iterator for Iter<'query, 'world>
{
- type Item = EntityHandle<'query>;
+ type Item = EntityHandle<'world>;
fn next(&mut self) -> Option<Self::Item>
{
@@ -85,8 +85,8 @@ type ComponentIterMapFnOutput<'a> = Zip<RepeatN<&'a Archetype>, EntityIter<'a>>;
type ComponentIterMapFn = for<'a> fn(&'a Archetype) -> ComponentIterMapFnOutput<'a>;
-type QueryEntityIter<'query> = FlatMap<
- ArchetypeRefIter<'query, 'query>,
- ComponentIterMapFnOutput<'query>,
+type QueryEntityIter<'query, 'world> = FlatMap<
+ ArchetypeRefIter<'world, 'query>,
+ ComponentIterMapFnOutput<'world>,
ComponentIterMapFn,
>;