summaryrefslogtreecommitdiff
path: root/ecs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2025-03-23 20:23:47 +0100
committerHampusM <hampus@hampusmat.com>2025-03-23 20:23:47 +0100
commit727756c717bca951fc6f8e25d4d206b95d62fbb9 (patch)
tree903f1c9ec852d23dc47b582b2c560296b6ae07a2 /ecs
parent0a7549ebaa7683b0c58379c2b0b4320981124acf (diff)
refactor(ecs): rename query::ComponentIter to IterHEADmaster
Diffstat (limited to 'ecs')
-rw-r--r--ecs/src/lib.rs10
-rw-r--r--ecs/src/query.rs20
2 files changed, 12 insertions, 18 deletions
diff --git a/ecs/src/lib.rs b/ecs/src/lib.rs
index 3adc415..59129b0 100644
--- a/ecs/src/lib.rs
+++ b/ecs/src/lib.rs
@@ -20,7 +20,7 @@ use crate::phase::{Phase, START as START_PHASE};
use crate::query::flexible::Query as FlexibleQuery;
use crate::query::term::Without;
use crate::query::{
- ComponentIter,
+ Iter as QueryIter,
TermWithFieldTuple as QueryTermWithFieldTuple,
TermWithoutFieldTuple as QueryTermWithoutFieldTuple,
Terms as QueryTerms,
@@ -534,11 +534,6 @@ impl World
fn emit_event_by_id(&self, event_id: Uid)
{
- //let query = self.flexible_query([
- // ComponentMetadata::of::<SystemComponent>(),
- // ComponentMetadata { id: event_id, is_optional: false },
- //]);
-
let mut query_required_ids = [SystemComponent::id(), event_id];
let query = self.flexible_query(
@@ -547,8 +542,7 @@ impl World
.build(),
);
- for (system,) in ComponentIter::<(&SystemComponent,), _>::new(self, query.iter())
- {
+ for (system,) in QueryIter::<(&SystemComponent,), _>::new(self, query.iter()) {
unsafe {
system.system.run(self);
}
diff --git a/ecs/src/query.rs b/ecs/src/query.rs
index 668c573..9b8aeed 100644
--- a/ecs/src/query.rs
+++ b/ecs/src/query.rs
@@ -36,11 +36,11 @@ where
#[must_use]
pub fn iter<'query>(
&'query self,
- ) -> ComponentIter<'query, 'world, FieldTerms, FlexibleQueryIter<'query>>
+ ) -> Iter<'query, 'world, FieldTerms, FlexibleQueryIter<'query>>
{
tracing::trace!("Searching for {}", std::any::type_name::<FieldTerms>());
- ComponentIter {
+ Iter {
world: self.world,
iter: self.inner.iter(),
comps_pd: PhantomData,
@@ -48,7 +48,7 @@ where
}
/// Iterates over the entities matching this query, the iterator item being the entity
- /// [`Uid`] and the entity components.
+ /// [`Uid`] and the matching entity components.
#[must_use]
pub fn iter_with_euids<'query>(
&'query self,
@@ -67,18 +67,18 @@ where
/// `func`.
///
/// This function exists so that a custom [`EntityHandle`] iterator can be given to
- /// [`ComponentIter`] without giving the user access to a reference to the [`World`].
+ /// [`Iter`] without giving the user access to a reference to the [`World`].
#[must_use]
pub fn iter_with<'query, OutIter>(
&'query self,
func: impl FnOnce(FlexibleQueryIter<'query>) -> OutIter,
- ) -> ComponentIter<'query, 'world, FieldTerms, OutIter>
+ ) -> Iter<'query, 'world, FieldTerms, OutIter>
where
OutIter: Iterator<Item = EntityHandle<'query>>,
{
tracing::trace!("Searching for {}", std::any::type_name::<FieldTerms>());
- ComponentIter {
+ Iter {
world: self.world,
iter: func(self.inner.iter()),
comps_pd: PhantomData,
@@ -113,7 +113,7 @@ where
FieldTerms: TermWithFieldTuple + 'world,
FieldlessTerms: TermWithoutFieldTuple,
{
- type IntoIter = ComponentIter<'query, 'world, FieldTerms, FlexibleQueryIter<'query>>;
+ type IntoIter = Iter<'query, 'world, FieldTerms, FlexibleQueryIter<'query>>;
type Item = FieldTerms::Fields<'query>;
fn into_iter(self) -> Self::IntoIter
@@ -330,7 +330,7 @@ pub trait TermWithFieldTuple
) -> Self::Fields<'component>;
}
-pub struct ComponentIter<'query, 'world, FieldTerms, EntityHandleIter>
+pub struct Iter<'query, 'world, FieldTerms, EntityHandleIter>
where
FieldTerms: TermWithFieldTuple + 'world,
EntityHandleIter: Iterator<Item = EntityHandle<'query>>,
@@ -341,7 +341,7 @@ where
}
impl<'query, 'world, FieldTerms, EntityHandleIter>
- ComponentIter<'query, 'world, FieldTerms, EntityHandleIter>
+ Iter<'query, 'world, FieldTerms, EntityHandleIter>
where
FieldTerms: TermWithFieldTuple + 'world,
EntityHandleIter: Iterator<Item = EntityHandle<'query>>,
@@ -360,7 +360,7 @@ where
}
impl<'query, 'world, FieldTerms, EntityHandleIter> Iterator
- for ComponentIter<'query, 'world, FieldTerms, EntityHandleIter>
+ for Iter<'query, 'world, FieldTerms, EntityHandleIter>
where
FieldTerms: TermWithFieldTuple + 'world,
EntityHandleIter: Iterator<Item = EntityHandle<'query>>,