Diagnostic map semantics.

MozReview-Commit-ID: C0a5g6xMPY0
This commit is contained in:
Bobby Holley 2017-09-28 19:10:46 -05:00
parent 438b9df00c
commit f5c5be00a7
11 changed files with 296 additions and 69 deletions

View file

@ -159,6 +159,15 @@ impl<T> PerPseudoElementMap<T> {
*self = Self::default();
}
/// Invokes a callback on each non-None entry.
pub fn for_each<F: FnMut(&mut T)>(&mut self, mut f: F) {
for entry in self.entries.iter_mut() {
if entry.is_some() {
f(entry.as_mut().unwrap());
}
}
}
/// Set an entry value.
///
/// Returns an error if the element is not a simple pseudo.