diff options
Diffstat (limited to 'ecs/src/query.rs')
-rw-r--r-- | ecs/src/query.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/ecs/src/query.rs b/ecs/src/query.rs index a2edc4d..dcd0b0e 100644 --- a/ecs/src/query.rs +++ b/ecs/src/query.rs @@ -2,10 +2,9 @@ use std::any::{type_name, Any}; use std::collections::HashSet; use std::iter::{Flatten, Map}; use std::marker::PhantomData; -use std::slice::Iter as SliceIter; use std::sync::{Arc, Weak}; -use crate::component::storage::Archetype; +use crate::component::storage::{Archetype, ArchetypeRefIter}; use crate::component::{ Id as ComponentId, IsOptional as ComponentIsOptional, @@ -46,7 +45,6 @@ where .component_storage .find_entities(&Comps::ids()) .unwrap_or_else(|| panic!("Could not find {:?}", type_name::<Comps>())) - .iter() .map((|archetype| archetype.components.as_slice()) as ComponentIterMapFn) .flatten(), comps_pd: PhantomData, @@ -218,11 +216,11 @@ where } } -type ComponentIterMapFn = for<'a> fn(&'a &'a Archetype) -> &'a [Vec<EntityComponent>]; +type ComponentIterMapFn = for<'a> fn(&'a Archetype) -> &'a [Vec<EntityComponent>]; pub struct ComponentIter<'world, Comps> { - entities: Flatten<Map<SliceIter<'world, &'world Archetype>, ComponentIterMapFn>>, + entities: Flatten<Map<ArchetypeRefIter<'world>, ComponentIterMapFn>>, comps_pd: PhantomData<Comps>, } |