Skip to content

Commit

Permalink
Rollup merge of rust-lang#64836 - lzutao:stabilize-map_get_key_value,…
Browse files Browse the repository at this point in the history
… r=SimonSapin

Stabilize map_get_key_value feature

FCP done in rust-lang#49347 (comment)
r? @SimonSapin
Closes rust-lang#49347
  • Loading branch information
Centril authored Sep 28, 2019
2 parents dd45b80 + c482c84 commit e687522
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/liballoc/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,15 +580,14 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// # Examples
///
/// ```
/// #![feature(map_get_key_value)]
/// use std::collections::BTreeMap;
///
/// let mut map = BTreeMap::new();
/// map.insert(1, "a");
/// assert_eq!(map.get_key_value(&1), Some((&1, &"a")));
/// assert_eq!(map.get_key_value(&2), None);
/// ```
#[unstable(feature = "map_get_key_value", issue = "49347")]
#[stable(feature = "map_get_key_value", since = "1.40.0")]
pub fn get_key_value<Q: ?Sized>(&self, k: &Q) -> Option<(&K, &V)>
where K: Borrow<Q>,
Q: Ord
Expand Down
3 changes: 1 addition & 2 deletions src/libstd/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -714,15 +714,14 @@ where
/// # Examples
///
/// ```
/// #![feature(map_get_key_value)]
/// use std::collections::HashMap;
///
/// let mut map = HashMap::new();
/// map.insert(1, "a");
/// assert_eq!(map.get_key_value(&1), Some((&1, &"a")));
/// assert_eq!(map.get_key_value(&2), None);
/// ```
#[unstable(feature = "map_get_key_value", issue = "49347")]
#[stable(feature = "map_get_key_value", since = "1.40.0")]
#[inline]
pub fn get_key_value<Q: ?Sized>(&self, k: &Q) -> Option<(&K, &V)>
where
Expand Down

0 comments on commit e687522

Please sign in to comment.