add iter_mut method to events struct

This commit is contained in:
Matthew Nicholson 2019-03-31 01:38:42 -04:00
parent b1d7f80dad
commit d4aee284e5
1 changed files with 10 additions and 0 deletions

View File

@ -42,6 +42,16 @@ macro_rules! declare_events_struct {
) )
)* )*
} }
pub fn iter_mut(&mut self) -> impl Iterator<Item = (&'static str, &mut T)> {
iter::empty()
$(
.chain(
self.$name.iter_mut()
.map(|value| (stringify!($name), value))
)
)*
}
} }
impl<T> Default for Events<T> { impl<T> Default for Events<T> {