sorted_map: add contains_key function

This commit is contained in:
ljedrz 2018-11-18 19:00:22 +01:00
parent 08c6bda3ee
commit 5b6401f09d

View File

@ -260,6 +260,14 @@ impl<K: Ord, V> SortedMap<K, V> {
(start, end)
}
#[inline]
pub fn contains_key<Q>(&self, key: &Q) -> bool
where K: Borrow<Q>,
Q: Ord + ?Sized
{
self.get(key).is_some()
}
}
impl<K: Ord, V> IntoIterator for SortedMap<K, V> {