iter_mut() for Assets type (#3118)

# Objective

Fixes #3117 

## Solution

I took `get_mut()` and did it for all the elements 😏 


Co-authored-by: MiniaczQ <jakub.motyka.2000@gmail.com>
This commit is contained in:
MiniaczQ 2021-11-13 04:26:42 +00:00
parent 5127274b31
commit 8b30dc6354

View file

@ -133,6 +133,15 @@ impl<T: Asset> Assets<T> {
self.assets.iter().map(|(k, v)| (*k, v))
}
pub fn iter_mut(&mut self) -> impl Iterator<Item = (HandleId, &mut T)> {
for id in self.assets.keys() {
self.events.send(AssetEvent::Modified {
handle: Handle::weak(*id),
});
}
self.assets.iter_mut().map(|(k, v)| (*k, v))
}
pub fn ids(&self) -> impl Iterator<Item = HandleId> + '_ {
self.assets.keys().cloned()
}