From 158e36bf6bfcbc2ed0ffc670788ed8c0abd3f282 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 9 Dec 2024 12:55:46 +0100 Subject: feat(ecs): add Relationship function returning target UID iter --- ecs/src/relationship.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ecs/src') diff --git a/ecs/src/relationship.rs b/ecs/src/relationship.rs index 0ebd9c2..44ed93a 100644 --- a/ecs/src/relationship.rs +++ b/ecs/src/relationship.rs @@ -365,6 +365,12 @@ where } } + pub fn target_uids(&self) -> impl Iterator + '_ + { + (0..self.target_count()) + .map_while(|target_index| self.get_target(target_index).copied()) + } + /// Returns a iterator of the components of the targets of this relationship. #[must_use] pub fn iter(&self) -> TargetComponentIter<'_, 'rel_comp, Kind, ComponentT> -- cgit v1.2.3-18-g5258