Refactor code for apply/revert, implement Update/Apply/RevertLayout

This commit is contained in:
Alex Auvolat
2022-05-06 17:14:09 +02:00
parent 01c4876fb4
commit dd54d0b2b1
13 changed files with 179 additions and 63 deletions
+5
View File
@@ -140,6 +140,11 @@ where
self.vals.clear();
}
/// Retain only values that match a certain predicate
pub fn retain(&mut self, pred: impl FnMut(&(K, u64, V)) -> bool) {
self.vals.retain(pred);
}
/// Get a reference to the value assigned to a key
pub fn get(&self, k: &K) -> Option<&V> {
match self.vals.binary_search_by(|(k2, _, _)| k2.cmp(k)) {