@@ -362,6 +362,13 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Iter<'_, K, V> {
362
362
}
363
363
}
364
364
365
+ #[ stable( feature = "default_iters" , since = "CURRENT_RUSTC_VERSION" ) ]
366
+ impl < ' a , K : ' a , V : ' a > Default for Iter < ' a , K , V > {
367
+ fn default ( ) -> Self {
368
+ Iter { range : Default :: default ( ) , length : 0 }
369
+ }
370
+ }
371
+
365
372
/// A mutable iterator over the entries of a `BTreeMap`.
366
373
///
367
374
/// This `struct` is created by the [`iter_mut`] method on [`BTreeMap`]. See its
@@ -386,6 +393,13 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for IterMut<'_, K, V> {
386
393
}
387
394
}
388
395
396
+ #[ stable( feature = "default_iters" , since = "CURRENT_RUSTC_VERSION" ) ]
397
+ impl < ' a , K : ' a , V : ' a > Default for IterMut < ' a , K , V > {
398
+ fn default ( ) -> Self {
399
+ IterMut { range : Default :: default ( ) , length : 0 , _marker : PhantomData { } }
400
+ }
401
+ }
402
+
389
403
/// An owning iterator over the entries of a `BTreeMap`.
390
404
///
391
405
/// This `struct` is created by the [`into_iter`] method on [`BTreeMap`]
@@ -421,6 +435,13 @@ impl<K: Debug, V: Debug, A: Allocator + Clone> Debug for IntoIter<K, V, A> {
421
435
}
422
436
}
423
437
438
+ #[ stable( feature = "default_iters" , since = "CURRENT_RUSTC_VERSION" ) ]
439
+ impl < K , V > Default for IntoIter < K , V > {
440
+ fn default ( ) -> Self {
441
+ IntoIter { range : Default :: default ( ) , length : 0 , alloc : Global }
442
+ }
443
+ }
444
+
424
445
/// An iterator over the keys of a `BTreeMap`.
425
446
///
426
447
/// This `struct` is created by the [`keys`] method on [`BTreeMap`]. See its
@@ -1768,6 +1789,13 @@ impl<K, V> Clone for Keys<'_, K, V> {
1768
1789
}
1769
1790
}
1770
1791
1792
+ #[ stable( feature = "default_iters" , since = "CURRENT_RUSTC_VERSION" ) ]
1793
+ impl < K , V > Default for Keys < ' _ , K , V > {
1794
+ fn default ( ) -> Self {
1795
+ Keys { inner : Default :: default ( ) }
1796
+ }
1797
+ }
1798
+
1771
1799
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1772
1800
impl < ' a , K , V > Iterator for Values < ' a , K , V > {
1773
1801
type Item = & ' a V ;
@@ -1809,6 +1837,13 @@ impl<K, V> Clone for Values<'_, K, V> {
1809
1837
}
1810
1838
}
1811
1839
1840
+ #[ stable( feature = "default_iters" , since = "CURRENT_RUSTC_VERSION" ) ]
1841
+ impl < K , V > Default for Values < ' _ , K , V > {
1842
+ fn default ( ) -> Self {
1843
+ Values { inner : Default :: default ( ) }
1844
+ }
1845
+ }
1846
+
1812
1847
/// An iterator produced by calling `drain_filter` on BTreeMap.
1813
1848
#[ unstable( feature = "btree_drain_filter" , issue = "70530" ) ]
1814
1849
pub struct DrainFilter <
@@ -1945,6 +1980,13 @@ impl<'a, K, V> Iterator for Range<'a, K, V> {
1945
1980
}
1946
1981
}
1947
1982
1983
+ #[ stable( feature = "default_iters" , since = "CURRENT_RUSTC_VERSION" ) ]
1984
+ impl < K , V > Default for Range < ' _ , K , V > {
1985
+ fn default ( ) -> Self {
1986
+ Range { inner : Default :: default ( ) }
1987
+ }
1988
+ }
1989
+
1948
1990
#[ stable( feature = "map_values_mut" , since = "1.10.0" ) ]
1949
1991
impl < ' a , K , V > Iterator for ValuesMut < ' a , K , V > {
1950
1992
type Item = & ' a mut V ;
@@ -2021,6 +2063,13 @@ impl<K, V, A: Allocator + Clone> ExactSizeIterator for IntoKeys<K, V, A> {
2021
2063
#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
2022
2064
impl < K , V , A : Allocator + Clone > FusedIterator for IntoKeys < K , V , A > { }
2023
2065
2066
+ #[ stable( feature = "default_iters" , since = "CURRENT_RUSTC_VERSION" ) ]
2067
+ impl < K , V > Default for IntoKeys < K , V > {
2068
+ fn default ( ) -> Self {
2069
+ IntoKeys { inner : Default :: default ( ) }
2070
+ }
2071
+ }
2072
+
2024
2073
#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
2025
2074
impl < K , V , A : Allocator + Clone > Iterator for IntoValues < K , V , A > {
2026
2075
type Item = V ;
@@ -2055,6 +2104,13 @@ impl<K, V, A: Allocator + Clone> ExactSizeIterator for IntoValues<K, V, A> {
2055
2104
#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
2056
2105
impl < K , V , A : Allocator + Clone > FusedIterator for IntoValues < K , V , A > { }
2057
2106
2107
+ #[ stable( feature = "default_iters" , since = "CURRENT_RUSTC_VERSION" ) ]
2108
+ impl < K , V > Default for IntoValues < K , V > {
2109
+ fn default ( ) -> Self {
2110
+ IntoValues { inner : Default :: default ( ) }
2111
+ }
2112
+ }
2113
+
2058
2114
#[ stable( feature = "btree_range" , since = "1.17.0" ) ]
2059
2115
impl < ' a , K , V > DoubleEndedIterator for Range < ' a , K , V > {
2060
2116
fn next_back ( & mut self ) -> Option < ( & ' a K , & ' a V ) > {
0 commit comments