@@ -554,8 +554,8 @@ impl<K, V, S> HashMap<K, V, S> {
554
554
/// a.clear();
555
555
/// assert!(a.is_empty());
556
556
/// ```
557
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
558
557
#[ inline]
558
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
559
559
pub fn clear ( & mut self ) {
560
560
self . base . clear ( ) ;
561
561
}
@@ -746,8 +746,8 @@ where
746
746
/// assert_eq!(map.get_key_value(&1), Some((&1, &"a")));
747
747
/// assert_eq!(map.get_key_value(&2), None);
748
748
/// ```
749
- #[ stable( feature = "map_get_key_value" , since = "1.40.0" ) ]
750
749
#[ inline]
750
+ #[ stable( feature = "map_get_key_value" , since = "1.40.0" ) ]
751
751
pub fn get_key_value < Q : ?Sized > ( & self , k : & Q ) -> Option < ( & K , & V ) >
752
752
where
753
753
K : Borrow < Q > ,
@@ -772,8 +772,8 @@ where
772
772
/// assert_eq!(map.contains_key(&1), true);
773
773
/// assert_eq!(map.contains_key(&2), false);
774
774
/// ```
775
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
776
775
#[ inline]
776
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
777
777
pub fn contains_key < Q : ?Sized > ( & self , k : & Q ) -> bool
778
778
where
779
779
K : Borrow < Q > ,
@@ -800,8 +800,8 @@ where
800
800
/// }
801
801
/// assert_eq!(map[&1], "b");
802
802
/// ```
803
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
804
803
#[ inline]
804
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
805
805
pub fn get_mut < Q : ?Sized > ( & mut self , k : & Q ) -> Option < & mut V >
806
806
where
807
807
K : Borrow < Q > ,
@@ -834,8 +834,8 @@ where
834
834
/// assert_eq!(map.insert(37, "c"), Some("b"));
835
835
/// assert_eq!(map[&37], "c");
836
836
/// ```
837
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
838
837
#[ inline]
838
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
839
839
pub fn insert ( & mut self , k : K , v : V ) -> Option < V > {
840
840
self . base . insert ( k, v)
841
841
}
@@ -857,8 +857,8 @@ where
857
857
/// assert_eq!(map.remove(&1), Some("a"));
858
858
/// assert_eq!(map.remove(&1), None);
859
859
/// ```
860
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
861
860
#[ inline]
861
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
862
862
pub fn remove < Q : ?Sized > ( & mut self , k : & Q ) -> Option < V >
863
863
where
864
864
K : Borrow < Q > ,
@@ -886,8 +886,8 @@ where
886
886
/// assert_eq!(map.remove(&1), None);
887
887
/// # }
888
888
/// ```
889
- #[ stable( feature = "hash_map_remove_entry" , since = "1.27.0" ) ]
890
889
#[ inline]
890
+ #[ stable( feature = "hash_map_remove_entry" , since = "1.27.0" ) ]
891
891
pub fn remove_entry < Q : ?Sized > ( & mut self , k : & Q ) -> Option < ( K , V ) >
892
892
where
893
893
K : Borrow < Q > ,
@@ -909,8 +909,8 @@ where
909
909
/// map.retain(|&k, _| k % 2 == 0);
910
910
/// assert_eq!(map.len(), 4);
911
911
/// ```
912
- #[ stable( feature = "retain_hash_collection" , since = "1.18.0" ) ]
913
912
#[ inline]
913
+ #[ stable( feature = "retain_hash_collection" , since = "1.18.0" ) ]
914
914
pub fn retain < F > ( & mut self , f : F )
915
915
where
916
916
F : FnMut ( & K , & mut V ) -> bool ,
@@ -1647,7 +1647,7 @@ impl<'a, K, V, S> RawOccupiedEntryMut<'a, K, V, S> {
1647
1647
self . base . get ( )
1648
1648
}
1649
1649
1650
- /// Converts the OccupiedEntry into a mutable reference to the value in the entry
1650
+ /// Converts the ` OccupiedEntry` into a mutable reference to the value in the entry
1651
1651
/// with a lifetime bound to the map itself.
1652
1652
#[ inline]
1653
1653
#[ unstable( feature = "hash_raw_entry" , issue = "56167" ) ]
@@ -1676,7 +1676,7 @@ impl<'a, K, V, S> RawOccupiedEntryMut<'a, K, V, S> {
1676
1676
self . base . get_key_value_mut ( )
1677
1677
}
1678
1678
1679
- /// Converts the OccupiedEntry into a mutable reference to the key and value in the entry
1679
+ /// Converts the ` OccupiedEntry` into a mutable reference to the key and value in the entry
1680
1680
/// with a lifetime bound to the map itself.
1681
1681
#[ inline]
1682
1682
#[ unstable( feature = "hash_raw_entry" , issue = "56167" ) ]
@@ -1714,7 +1714,7 @@ impl<'a, K, V, S> RawOccupiedEntryMut<'a, K, V, S> {
1714
1714
}
1715
1715
1716
1716
impl < ' a , K , V , S > RawVacantEntryMut < ' a , K , V , S > {
1717
- /// Sets the value of the entry with the VacantEntry's key,
1717
+ /// Sets the value of the entry with the ` VacantEntry` 's key,
1718
1718
/// and returns a mutable reference to it.
1719
1719
#[ inline]
1720
1720
#[ unstable( feature = "hash_raw_entry" , issue = "56167" ) ]
@@ -2173,7 +2173,6 @@ where
2173
2173
}
2174
2174
2175
2175
impl < ' a , K , V > Entry < ' a , K , V > {
2176
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2177
2176
/// Ensures a value is in the entry by inserting the default if empty, and returns
2178
2177
/// a mutable reference to the value in the entry.
2179
2178
///
@@ -2191,14 +2190,14 @@ impl<'a, K, V> Entry<'a, K, V> {
2191
2190
/// assert_eq!(map["poneyland"], 6);
2192
2191
/// ```
2193
2192
#[ inline]
2193
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2194
2194
pub fn or_insert ( self , default : V ) -> & ' a mut V {
2195
2195
match self {
2196
2196
Occupied ( entry) => entry. into_mut ( ) ,
2197
2197
Vacant ( entry) => entry. insert ( default) ,
2198
2198
}
2199
2199
}
2200
2200
2201
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2202
2201
/// Ensures a value is in the entry by inserting the result of the default function if empty,
2203
2202
/// and returns a mutable reference to the value in the entry.
2204
2203
///
@@ -2215,14 +2214,14 @@ impl<'a, K, V> Entry<'a, K, V> {
2215
2214
/// assert_eq!(map["poneyland"], "hoho".to_string());
2216
2215
/// ```
2217
2216
#[ inline]
2217
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2218
2218
pub fn or_insert_with < F : FnOnce ( ) -> V > ( self , default : F ) -> & ' a mut V {
2219
2219
match self {
2220
2220
Occupied ( entry) => entry. into_mut ( ) ,
2221
2221
Vacant ( entry) => entry. insert ( default ( ) ) ,
2222
2222
}
2223
2223
}
2224
2224
2225
- #[ unstable( feature = "or_insert_with_key" , issue = "71024" ) ]
2226
2225
/// Ensures a value is in the entry by inserting, if empty, the result of the default function,
2227
2226
/// which takes the key as its argument, and returns a mutable reference to the value in the
2228
2227
/// entry.
@@ -2240,6 +2239,7 @@ impl<'a, K, V> Entry<'a, K, V> {
2240
2239
/// assert_eq!(map["poneyland"], 9);
2241
2240
/// ```
2242
2241
#[ inline]
2242
+ #[ unstable( feature = "or_insert_with_key" , issue = "71024" ) ]
2243
2243
pub fn or_insert_with_key < F : FnOnce ( & K ) -> V > ( self , default : F ) -> & ' a mut V {
2244
2244
match self {
2245
2245
Occupied ( entry) => entry. into_mut ( ) ,
@@ -2304,7 +2304,7 @@ impl<'a, K, V> Entry<'a, K, V> {
2304
2304
}
2305
2305
}
2306
2306
2307
- /// Sets the value of the entry, and returns an OccupiedEntry.
2307
+ /// Sets the value of the entry, and returns an ` OccupiedEntry` .
2308
2308
///
2309
2309
/// # Examples
2310
2310
///
@@ -2331,7 +2331,6 @@ impl<'a, K, V> Entry<'a, K, V> {
2331
2331
}
2332
2332
2333
2333
impl < ' a , K , V : Default > Entry < ' a , K , V > {
2334
- #[ stable( feature = "entry_or_default" , since = "1.28.0" ) ]
2335
2334
/// Ensures a value is in the entry by inserting the default value if empty,
2336
2335
/// and returns a mutable reference to the value in the entry.
2337
2336
///
@@ -2348,6 +2347,7 @@ impl<'a, K, V: Default> Entry<'a, K, V> {
2348
2347
/// # }
2349
2348
/// ```
2350
2349
#[ inline]
2350
+ #[ stable( feature = "entry_or_default" , since = "1.28.0" ) ]
2351
2351
pub fn or_default ( self ) -> & ' a mut V {
2352
2352
match self {
2353
2353
Occupied ( entry) => entry. into_mut ( ) ,
@@ -2452,7 +2452,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
2452
2452
self . base . get_mut ( )
2453
2453
}
2454
2454
2455
- /// Converts the OccupiedEntry into a mutable reference to the value in the entry
2455
+ /// Converts the ` OccupiedEntry` into a mutable reference to the value in the entry
2456
2456
/// with a lifetime bound to the map itself.
2457
2457
///
2458
2458
/// If you need multiple references to the `OccupiedEntry`, see [`get_mut`].
@@ -2624,7 +2624,7 @@ impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> {
2624
2624
self . base . into_key ( )
2625
2625
}
2626
2626
2627
- /// Sets the value of the entry with the VacantEntry's key,
2627
+ /// Sets the value of the entry with the ` VacantEntry` 's key,
2628
2628
/// and returns a mutable reference to it.
2629
2629
///
2630
2630
/// # Examples
@@ -2646,8 +2646,8 @@ impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> {
2646
2646
self . base . insert ( value)
2647
2647
}
2648
2648
2649
- /// Sets the value of the entry with the VacantEntry's key,
2650
- /// and returns an OccupiedEntry.
2649
+ /// Sets the value of the entry with the ` VacantEntry` 's key,
2650
+ /// and returns an ` OccupiedEntry` .
2651
2651
///
2652
2652
/// # Examples
2653
2653
///
0 commit comments