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.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/ecs/src/query/flexible.rs b/ecs/src/query/flexible.rs
index 6d65ee0..936ab82 100644
--- a/ecs/src/query/flexible.rs
+++ b/ecs/src/query/flexible.rs
@@ -22,7 +22,6 @@ impl<'world, const MAX_TERM_CNT: usize> Query<'world, MAX_TERM_CNT>
pub fn iter(&self) -> Iter<'_>
{
Iter {
- world: self.world,
iter: self
.world
.data
@@ -37,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,8 +65,8 @@ impl<'query, const MAX_TERM_CNT: usize> IntoIterator for &'query Query<'_, MAX_T
pub struct Iter<'query>
{
- world: &'query World,
iter: QueryEntityIter<'query>,
+ world: &'query World,
}
impl<'query> Iterator for Iter<'query>
@@ -71,7 +77,7 @@ impl<'query> Iterator for Iter<'query>
{
let (archetype, entity) = self.iter.next()?;
- Some(EntityHandle::new(self.world, archetype, entity))
+ Some(EntityHandle::new(archetype, entity, self.world))
}
}