From 727756c717bca951fc6f8e25d4d206b95d62fbb9 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 23 Mar 2025 20:23:47 +0100 Subject: refactor(ecs): rename query::ComponentIter to Iter --- ecs/src/query.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'ecs/src/query.rs') 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::()); - 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>, { tracing::trace!("Searching for {}", std::any::type_name::()); - 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>, @@ -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>, @@ -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>, -- cgit v1.2.3-18-g5258