@@ -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 ,
@@ -1542,7 +1542,7 @@ impl<'a, K, V, S> RawOccupiedEntryMut<'a, K, V, S> {
1542
1542
self . base . get ( )
1543
1543
}
1544
1544
1545
- /// Converts the OccupiedEntry into a mutable reference to the value in the entry
1545
+ /// Converts the ` OccupiedEntry` into a mutable reference to the value in the entry
1546
1546
/// with a lifetime bound to the map itself.
1547
1547
#[ inline]
1548
1548
#[ unstable( feature = "hash_raw_entry" , issue = "56167" ) ]
@@ -1571,7 +1571,7 @@ impl<'a, K, V, S> RawOccupiedEntryMut<'a, K, V, S> {
1571
1571
self . base . get_key_value_mut ( )
1572
1572
}
1573
1573
1574
- /// Converts the OccupiedEntry into a mutable reference to the key and value in the entry
1574
+ /// Converts the ` OccupiedEntry` into a mutable reference to the key and value in the entry
1575
1575
/// with a lifetime bound to the map itself.
1576
1576
#[ inline]
1577
1577
#[ unstable( feature = "hash_raw_entry" , issue = "56167" ) ]
@@ -1609,7 +1609,7 @@ impl<'a, K, V, S> RawOccupiedEntryMut<'a, K, V, S> {
1609
1609
}
1610
1610
1611
1611
impl < ' a , K , V , S > RawVacantEntryMut < ' a , K , V , S > {
1612
- /// Sets the value of the entry with the VacantEntry's key,
1612
+ /// Sets the value of the entry with the ` VacantEntry` 's key,
1613
1613
/// and returns a mutable reference to it.
1614
1614
#[ inline]
1615
1615
#[ unstable( feature = "hash_raw_entry" , issue = "56167" ) ]
@@ -2072,7 +2072,6 @@ where
2072
2072
}
2073
2073
2074
2074
impl < ' a , K , V > Entry < ' a , K , V > {
2075
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2076
2075
/// Ensures a value is in the entry by inserting the default if empty, and returns
2077
2076
/// a mutable reference to the value in the entry.
2078
2077
///
@@ -2090,14 +2089,14 @@ impl<'a, K, V> Entry<'a, K, V> {
2090
2089
/// assert_eq!(map["poneyland"], 6);
2091
2090
/// ```
2092
2091
#[ inline]
2092
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2093
2093
pub fn or_insert ( self , default : V ) -> & ' a mut V {
2094
2094
match self {
2095
2095
Occupied ( entry) => entry. into_mut ( ) ,
2096
2096
Vacant ( entry) => entry. insert ( default) ,
2097
2097
}
2098
2098
}
2099
2099
2100
- #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2101
2100
/// Ensures a value is in the entry by inserting the result of the default function if empty,
2102
2101
/// and returns a mutable reference to the value in the entry.
2103
2102
///
@@ -2114,14 +2113,14 @@ impl<'a, K, V> Entry<'a, K, V> {
2114
2113
/// assert_eq!(map["poneyland"], "hoho".to_string());
2115
2114
/// ```
2116
2115
#[ inline]
2116
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
2117
2117
pub fn or_insert_with < F : FnOnce ( ) -> V > ( self , default : F ) -> & ' a mut V {
2118
2118
match self {
2119
2119
Occupied ( entry) => entry. into_mut ( ) ,
2120
2120
Vacant ( entry) => entry. insert ( default ( ) ) ,
2121
2121
}
2122
2122
}
2123
2123
2124
- #[ unstable( feature = "or_insert_with_key" , issue = "71024" ) ]
2125
2124
/// Ensures a value is in the entry by inserting, if empty, the result of the default function,
2126
2125
/// which takes the key as its argument, and returns a mutable reference to the value in the
2127
2126
/// entry.
@@ -2139,6 +2138,7 @@ impl<'a, K, V> Entry<'a, K, V> {
2139
2138
/// assert_eq!(map["poneyland"], 9);
2140
2139
/// ```
2141
2140
#[ inline]
2141
+ #[ unstable( feature = "or_insert_with_key" , issue = "71024" ) ]
2142
2142
pub fn or_insert_with_key < F : FnOnce ( & K ) -> V > ( self , default : F ) -> & ' a mut V {
2143
2143
match self {
2144
2144
Occupied ( entry) => entry. into_mut ( ) ,
@@ -2203,7 +2203,7 @@ impl<'a, K, V> Entry<'a, K, V> {
2203
2203
}
2204
2204
}
2205
2205
2206
- /// Sets the value of the entry, and returns an OccupiedEntry.
2206
+ /// Sets the value of the entry, and returns an ` OccupiedEntry` .
2207
2207
///
2208
2208
/// # Examples
2209
2209
///
@@ -2230,7 +2230,6 @@ impl<'a, K, V> Entry<'a, K, V> {
2230
2230
}
2231
2231
2232
2232
impl < ' a , K , V : Default > Entry < ' a , K , V > {
2233
- #[ stable( feature = "entry_or_default" , since = "1.28.0" ) ]
2234
2233
/// Ensures a value is in the entry by inserting the default value if empty,
2235
2234
/// and returns a mutable reference to the value in the entry.
2236
2235
///
@@ -2247,6 +2246,7 @@ impl<'a, K, V: Default> Entry<'a, K, V> {
2247
2246
/// # }
2248
2247
/// ```
2249
2248
#[ inline]
2249
+ #[ stable( feature = "entry_or_default" , since = "1.28.0" ) ]
2250
2250
pub fn or_default ( self ) -> & ' a mut V {
2251
2251
match self {
2252
2252
Occupied ( entry) => entry. into_mut ( ) ,
@@ -2351,7 +2351,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
2351
2351
self . base . get_mut ( )
2352
2352
}
2353
2353
2354
- /// Converts the OccupiedEntry into a mutable reference to the value in the entry
2354
+ /// Converts the ` OccupiedEntry` into a mutable reference to the value in the entry
2355
2355
/// with a lifetime bound to the map itself.
2356
2356
///
2357
2357
/// If you need multiple references to the `OccupiedEntry`, see [`get_mut`].
@@ -2523,7 +2523,7 @@ impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> {
2523
2523
self . base . into_key ( )
2524
2524
}
2525
2525
2526
- /// Sets the value of the entry with the VacantEntry's key,
2526
+ /// Sets the value of the entry with the ` VacantEntry` 's key,
2527
2527
/// and returns a mutable reference to it.
2528
2528
///
2529
2529
/// # Examples
@@ -2545,8 +2545,8 @@ impl<'a, K: 'a, V: 'a> VacantEntry<'a, K, V> {
2545
2545
self . base . insert ( value)
2546
2546
}
2547
2547
2548
- /// Sets the value of the entry with the VacantEntry's key,
2549
- /// and returns an OccupiedEntry.
2548
+ /// Sets the value of the entry with the ` VacantEntry` 's key,
2549
+ /// and returns an ` OccupiedEntry` .
2550
2550
///
2551
2551
/// # Examples
2552
2552
///
0 commit comments