summaryrefslogtreecommitdiff
path: root/ecs/src/query/flexible.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ecs/src/query/flexible.rs')
-rw-r--r--ecs/src/query/flexible.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/ecs/src/query/flexible.rs b/ecs/src/query/flexible.rs
index add30b0..936ab82 100644
--- a/ecs/src/query/flexible.rs
+++ b/ecs/src/query/flexible.rs
@@ -36,9 +36,16 @@ impl<'world, const MAX_TERM_CNT: usize> Query<'world, MAX_TERM_CNT>
.zip(archetype.entities())
}) as ComponentIterMapFn,
),
+ world: self.world,
}
}
+ #[must_use]
+ pub fn world(&self) -> &'world World
+ {
+ self.world
+ }
+
pub(crate) fn new(world: &'world World, terms: Terms<MAX_TERM_CNT>) -> Self
{
Self { world, terms }
@@ -59,6 +66,7 @@ impl<'query, const MAX_TERM_CNT: usize> IntoIterator for &'query Query<'_, MAX_T
pub struct Iter<'query>
{
iter: QueryEntityIter<'query>,
+ world: &'query World,
}
impl<'query> Iterator for Iter<'query>
@@ -69,7 +77,7 @@ impl<'query> Iterator for Iter<'query>
{
let (archetype, entity) = self.iter.next()?;
- Some(EntityHandle::new(archetype, entity))
+ Some(EntityHandle::new(archetype, entity, self.world))
}
}