@@ -362,6 +362,13 @@ impl<K: fmt::Debug, V: fmt::Debug> fmt::Debug for Iter<'_, K, V> {
362362 }
363363}
364364
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+
365372/// A mutable iterator over the entries of a `BTreeMap`.
366373///
367374/// 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> {
386393 }
387394}
388395
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+
389403/// An owning iterator over the entries of a `BTreeMap`.
390404///
391405/// 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> {
421435 }
422436}
423437
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+
424445/// An iterator over the keys of a `BTreeMap`.
425446///
426447/// This `struct` is created by the [`keys`] method on [`BTreeMap`]. See its
@@ -1768,6 +1789,13 @@ impl<K, V> Clone for Keys<'_, K, V> {
17681789 }
17691790}
17701791
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+
17711799#[ stable( feature = "rust1" , since = "1.0.0" ) ]
17721800impl < ' a , K , V > Iterator for Values < ' a , K , V > {
17731801 type Item = & ' a V ;
@@ -1809,6 +1837,13 @@ impl<K, V> Clone for Values<'_, K, V> {
18091837 }
18101838}
18111839
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+
18121847/// An iterator produced by calling `drain_filter` on BTreeMap.
18131848#[ unstable( feature = "btree_drain_filter" , issue = "70530" ) ]
18141849pub struct DrainFilter <
@@ -1945,6 +1980,13 @@ impl<'a, K, V> Iterator for Range<'a, K, V> {
19451980 }
19461981}
19471982
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+
19481990#[ stable( feature = "map_values_mut" , since = "1.10.0" ) ]
19491991impl < ' a , K , V > Iterator for ValuesMut < ' a , K , V > {
19501992 type Item = & ' a mut V ;
@@ -2021,6 +2063,13 @@ impl<K, V, A: Allocator + Clone> ExactSizeIterator for IntoKeys<K, V, A> {
20212063#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
20222064impl < K , V , A : Allocator + Clone > FusedIterator for IntoKeys < K , V , A > { }
20232065
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+
20242073#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
20252074impl < K , V , A : Allocator + Clone > Iterator for IntoValues < K , V , A > {
20262075 type Item = V ;
@@ -2055,6 +2104,13 @@ impl<K, V, A: Allocator + Clone> ExactSizeIterator for IntoValues<K, V, A> {
20552104#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
20562105impl < K , V , A : Allocator + Clone > FusedIterator for IntoValues < K , V , A > { }
20572106
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+
20582114#[ stable( feature = "btree_range" , since = "1.17.0" ) ]
20592115impl < ' a , K , V > DoubleEndedIterator for Range < ' a , K , V > {
20602116 fn next_back ( & mut self ) -> Option < ( & ' a K , & ' a V ) > {
0 commit comments