Add a contains_key method to SparseMap.
This commit is contained in:
@@ -126,6 +126,11 @@ impl<K, V> SparseMap<K, V>
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return `true` if the map contains a value corresponding to `key`.
|
||||||
|
pub fn contains_key(&self, key: K) -> bool {
|
||||||
|
self.get(key).is_some()
|
||||||
|
}
|
||||||
|
|
||||||
/// Insert a value into the map.
|
/// Insert a value into the map.
|
||||||
///
|
///
|
||||||
/// If the map did not have this key present, `None` is returned.
|
/// If the map did not have this key present, `None` is returned.
|
||||||
|
|||||||
Reference in New Issue
Block a user