We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a050481 + 1ae5566 commit 584f476Copy full SHA for 584f476
src/map.rs
@@ -94,6 +94,20 @@ impl Map<String, Value> {
94
self.map.get_mut(key)
95
}
96
97
+ /// Returns the key-value pair matching the given key.
98
+ ///
99
+ /// The key may be any borrowed form of the map's key type, but the ordering
100
+ /// on the borrowed form *must* match the ordering on the key type.
101
+ #[inline]
102
+ #[cfg(any(feature = "preserve_order", not(no_btreemap_get_key_value)))]
103
+ pub fn get_key_value<Q>(&self, key: &Q) -> Option<(&String, &Value)>
104
+ where
105
+ String: Borrow<Q>,
106
+ Q: ?Sized + Ord + Eq + Hash,
107
+ {
108
+ self.map.get_key_value(key)
109
+ }
110
+
111
/// Inserts a key-value pair into the map.
112
///
113
/// If the map did not have this key present, `None` is returned.
0 commit comments