From 6d4921dbbe933701e2062a8230711a1e0b0cc179 Mon Sep 17 00:00:00 2001 From: copygirl Date: Sat, 21 Sep 2024 20:17:07 +0200 Subject: [PATCH] impl IntoIterator for Archetype --- src/ecs/archetype.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ecs/archetype.rs b/src/ecs/archetype.rs index fc36fca..179ce71 100644 --- a/src/ecs/archetype.rs +++ b/src/ecs/archetype.rs @@ -38,7 +38,18 @@ impl FromIterator for Archetype where T: Into, { + #[inline] fn from_iter>(iter: I) -> Self { Self::new(iter) } } + +impl IntoIterator for Archetype { + type Item = Component; + type IntoIter = std::vec::IntoIter; + + #[inline] + fn into_iter(self) -> Self::IntoIter { + self.components.into_iter() + } +}