Add signals() convenience iter on Event

This commit is contained in:
Félix Saparelli 2021-08-23 02:35:03 +12:00
parent cc5b1c988e
commit 931648a955
No known key found for this signature in database
GPG Key ID: B948C4BAE44FC474
1 changed files with 7 additions and 0 deletions

View File

@ -49,4 +49,11 @@ impl Event {
_ => None,
})
}
/// Return all signals in the event's particulars.
pub fn signals(&self) -> impl Iterator<Item = Signal> + '_ {
self.particulars.iter().filter_map(|p| match p {
Particle::Signal(s) => Some(*s),
_ => None,
})
}
}