Add RemovedComponentEvents::iter (#12815)
# Objective Sometimes it's useful to iterate over removed entities. For example, in my library [bevy_replicon](https://github.com/projectharmonia/bevy_replicon) I need it to iterate over all removals to replicate them over the network. Right now we do lookups, but it would be more convenient and faster to just iterate over all removals. ## Solution Add `RemovedComponentEvents::iter`. --- ## Changelog ### Added - `RemovedComponentEvents::iter` to iterate over all removed components. --------- Co-authored-by: Pablo Reinhardt <126117294+pablo-lua@users.noreply.github.com>
This commit is contained in:
parent
7618884b2f
commit
891c2f1203
@ -83,6 +83,11 @@ impl RemovedComponentEvents {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns an iterator over components and their entity events.
|
||||
pub fn iter(&self) -> impl Iterator<Item = (&ComponentId, &Events<RemovedComponentEntity>)> {
|
||||
self.event_sets.iter()
|
||||
}
|
||||
|
||||
/// Gets the event storage for a given component.
|
||||
pub fn get(
|
||||
&self,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user