@@ -952,7 +952,7 @@ where
952
952
/// ```
953
953
#[ inline]
954
954
#[ unstable( feature = "map_many_mut" , issue = "97601" ) ]
955
- pub fn get_many_mut < Q : ?Sized , const N : usize > ( & mut self , ks : [ & Q ; N ] ) -> Option < [ & ' _ mut V ; N ] >
955
+ pub fn get_many_mut < Q : ?Sized , const N : usize > ( & mut self , ks : [ & Q ; N ] ) -> [ Option < & ' _ mut V > ; N ]
956
956
where
957
957
K : Borrow < Q > ,
958
958
Q : Hash + Eq ,
@@ -1011,7 +1011,7 @@ where
1011
1011
pub unsafe fn get_many_unchecked_mut < Q : ?Sized , const N : usize > (
1012
1012
& mut self ,
1013
1013
ks : [ & Q ; N ] ,
1014
- ) -> Option < [ & ' _ mut V ; N ] >
1014
+ ) -> [ Option < & ' _ mut V > ; N ]
1015
1015
where
1016
1016
K : Borrow < Q > ,
1017
1017
Q : Hash + Eq ,
@@ -2978,64 +2978,6 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
2978
2978
pub fn remove ( self ) -> V {
2979
2979
self . base . remove ( )
2980
2980
}
2981
-
2982
- /// Replaces the entry, returning the old key and value. The new key in the hash map will be
2983
- /// the key used to create this entry.
2984
- ///
2985
- /// # Examples
2986
- ///
2987
- /// ```
2988
- /// #![feature(map_entry_replace)]
2989
- /// use std::collections::hash_map::{Entry, HashMap};
2990
- /// use std::rc::Rc;
2991
- ///
2992
- /// let mut map: HashMap<Rc<String>, u32> = HashMap::new();
2993
- /// map.insert(Rc::new("Stringthing".to_string()), 15);
2994
- ///
2995
- /// let my_key = Rc::new("Stringthing".to_string());
2996
- ///
2997
- /// if let Entry::Occupied(entry) = map.entry(my_key) {
2998
- /// // Also replace the key with a handle to our other key.
2999
- /// let (old_key, old_value): (Rc<String>, u32) = entry.replace_entry(16);
3000
- /// }
3001
- ///
3002
- /// ```
3003
- #[ inline]
3004
- #[ unstable( feature = "map_entry_replace" , issue = "44286" ) ]
3005
- pub fn replace_entry ( self , value : V ) -> ( K , V ) {
3006
- self . base . replace_entry ( value)
3007
- }
3008
-
3009
- /// Replaces the key in the hash map with the key used to create this entry.
3010
- ///
3011
- /// # Examples
3012
- ///
3013
- /// ```
3014
- /// #![feature(map_entry_replace)]
3015
- /// use std::collections::hash_map::{Entry, HashMap};
3016
- /// use std::rc::Rc;
3017
- ///
3018
- /// let mut map: HashMap<Rc<String>, u32> = HashMap::new();
3019
- /// let known_strings: Vec<Rc<String>> = Vec::new();
3020
- ///
3021
- /// // Initialise known strings, run program, etc.
3022
- ///
3023
- /// reclaim_memory(&mut map, &known_strings);
3024
- ///
3025
- /// fn reclaim_memory(map: &mut HashMap<Rc<String>, u32>, known_strings: &[Rc<String>] ) {
3026
- /// for s in known_strings {
3027
- /// if let Entry::Occupied(entry) = map.entry(Rc::clone(s)) {
3028
- /// // Replaces the entry's key with our version of it in `known_strings`.
3029
- /// entry.replace_key();
3030
- /// }
3031
- /// }
3032
- /// }
3033
- /// ```
3034
- #[ inline]
3035
- #[ unstable( feature = "map_entry_replace" , issue = "44286" ) ]
3036
- pub fn replace_key ( self ) -> K {
3037
- self . base . replace_key ( )
3038
- }
3039
2981
}
3040
2982
3041
2983
impl < ' a , K : ' a , V : ' a > VacantEntry < ' a , K , V > {
0 commit comments