summaryrefslogtreecommitdiffstats
path: root/vendor/toml/src/map.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/toml/src/map.rs')
-rw-r--r--vendor/toml/src/map.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/vendor/toml/src/map.rs b/vendor/toml/src/map.rs
index 5b3ff19b4..bd720a729 100644
--- a/vendor/toml/src/map.rs
+++ b/vendor/toml/src/map.rs
@@ -138,6 +138,20 @@ impl Map<String, Value> {
self.map.remove(key)
}
+ /// Retains only the elements specified by the `keep` predicate.
+ ///
+ /// In other words, remove all pairs `(k, v)` for which `keep(&k, &mut v)`
+ /// returns `false`.
+ ///
+ /// The elements are visited in iteration order.
+ #[inline]
+ pub fn retain<F>(&mut self, mut keep: F)
+ where
+ F: FnMut(&str, &mut Value) -> bool,
+ {
+ self.map.retain(|key, value| keep(key.as_str(), value));
+ }
+
/// Gets the given key's corresponding entry in the map for in-place
/// manipulation.
pub fn entry<S>(&mut self, key: S) -> Entry<'_>