Semantics for ProtectedHashMap.

MozReview-Commit-ID: K0m65uZi7iw
This commit is contained in:
Bobby Holley 2017-09-26 12:33:21 -07:00
parent e2c0ca5110
commit 98f370130d
9 changed files with 311 additions and 8 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.