From 5b6401f09db502b9e596bf7d756ccc97029dfe31 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Sun, 18 Nov 2018 19:00:22 +0100 Subject: sorted_map: add contains_key function --- src/librustc_data_structures/sorted_map.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/librustc_data_structures') diff --git a/src/librustc_data_structures/sorted_map.rs b/src/librustc_data_structures/sorted_map.rs index 2fa8453c4b5..3bd3d116607 100644 --- a/src/librustc_data_structures/sorted_map.rs +++ b/src/librustc_data_structures/sorted_map.rs @@ -260,6 +260,14 @@ impl SortedMap { (start, end) } + + #[inline] + pub fn contains_key(&self, key: &Q) -> bool + where K: Borrow, + Q: Ord + ?Sized + { + self.get(key).is_some() + } } impl IntoIterator for SortedMap { -- cgit 1.4.1-3-g733a5