Skip to content

Commit 5b6401f

Browse files
committed
sorted_map: add contains_key function
1 parent 08c6bda commit 5b6401f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: src/librustc_data_structures/sorted_map.rs

+8
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,14 @@ impl<K: Ord, V> SortedMap<K, V> {
260260

261261
(start, end)
262262
}
263+
264+
#[inline]
265+
pub fn contains_key<Q>(&self, key: &Q) -> bool
266+
where K: Borrow<Q>,
267+
Q: Ord + ?Sized
268+
{
269+
self.get(key).is_some()
270+
}
263271
}
264272

265273
impl<K: Ord, V> IntoIterator for SortedMap<K, V> {

0 commit comments

Comments
 (0)