diff options
-rw-r--r-- | ecs/src/lib.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/ecs/src/lib.rs b/ecs/src/lib.rs index 6106862..df46a5a 100644 --- a/ecs/src/lib.rs +++ b/ecs/src/lib.rs @@ -129,6 +129,19 @@ where } } +impl<'world, Comps> IntoIterator for &'world mut Query<'world, Comps> +where + Comps: ComponentSequence + 'world, +{ + type IntoIter = QueryComponentIter<'world, Comps>; + type Item = Comps::MutRefs<'world>; + + fn into_iter(self) -> Self::IntoIter + { + self.iter_mut() + } +} + pub struct QueryComponentIter<'world, Comps> { entity_iter: SliceIterMut<'world, Entity>, |