sorted_map: add contains_key function

This commit is contained in:
ljedrz
2018-11-18 19:00:22 +01:00
parent 08c6bda3ee
commit 5b6401f09d
@@ -260,6 +260,14 @@ fn range_slice_indices<R>(&self, range: R) -> (usize, usize)
(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> {