Skip to content

Commit

Permalink
sorted_map: add contains_key function
Browse files Browse the repository at this point in the history
  • Loading branch information
ljedrz committed Dec 10, 2018
1 parent 08c6bda commit 5b6401f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/librustc_data_structures/sorted_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down

0 comments on commit 5b6401f

Please sign in to comment.