summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-12-09 12:55:46 +0100
committerHampusM <hampus@hampusmat.com>2024-12-09 12:55:46 +0100
commit158e36bf6bfcbc2ed0ffc670788ed8c0abd3f282 (patch)
tree302ce073ab81d6f09a678b9fd96f95cd1e0f7ebe
parent82123b59e0be2fa10db04a6b1d7798382cbc0686 (diff)
feat(ecs): add Relationship function returning target UID iter
-rw-r--r--ecs/src/relationship.rs6
1 files changed, 6 insertions, 0 deletions
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<Item = Uid> + '_
+ {
+ (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>