diff options
author | HampusM <hampus@hampusmat.com> | 2024-11-16 17:14:20 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-11-16 17:14:20 +0100 |
commit | c9a07ff61b607478e264fc0581076643c750fe98 (patch) | |
tree | 640e6c6309af6f86df49c492057d281f5f7ea420 /ecs/src/query.rs | |
parent | 136d0511972fd31a82331cf769f8d309cd3438f8 (diff) |
refactor(ecs): remove system param compatability checking
Diffstat (limited to 'ecs/src/query.rs')
-rw-r--r-- | ecs/src/query.rs | 49 |
1 files changed, 1 insertions, 48 deletions
diff --git a/ecs/src/query.rs b/ecs/src/query.rs index 69bb35d..253398d 100644 --- a/ecs/src/query.rs +++ b/ecs/src/query.rs @@ -1,5 +1,3 @@ -use std::any::Any; -use std::collections::HashSet; use std::iter::{Filter, Flatten, Map}; use std::marker::PhantomData; @@ -10,11 +8,7 @@ use crate::component::storage::{ EntityIter, Storage as ComponentStorage, }; -use crate::component::{ - Component, - Metadata as ComponentMetadata, - Sequence as ComponentSequence, -}; +use crate::component::{Component, Sequence as ComponentSequence}; use crate::lock::{ReadGuard, WriteGuard}; use crate::query::options::Options; use crate::system::{ @@ -149,24 +143,6 @@ where { Self::new(world) } - - fn is_compatible<Other: SystemParam<'world>>() -> bool - { - let other_comparable = Other::get_comparable(); - - let Some(other_query_component_ids) = - other_comparable.downcast_ref::<QueryComponentIds>() - else { - return true; - }; - - !other_query_component_ids.contains_component_in::<Comps>() - } - - fn get_comparable() -> Box<dyn Any> - { - Box::new(QueryComponentIds { component_ids: Comps::metadata() }) - } } type ComponentIterMapFn = for<'a> fn(&'a Archetype) -> EntityIter<'a>; @@ -259,26 +235,3 @@ fn lock_component_ro( ); }) } - -#[derive(Debug)] -struct QueryComponentIds -{ - component_ids: Vec<ComponentMetadata>, -} - -impl QueryComponentIds -{ - fn contains_component_in<OtherComps>(&self) -> bool - where - OtherComps: ComponentSequence, - { - let other_ids = OtherComps::metadata() - .into_iter() - .map(|component_metadata| component_metadata.id) - .collect::<HashSet<_>>(); - - self.component_ids - .iter() - .all(|component_metadata| other_ids.contains(&component_metadata.id)) - } -} |