@@ -1404,6 +1404,14 @@ impl<K, V> Clone for Iter<'_, K, V> {
14041404 }
14051405}
14061406
1407+ #[ stable( feature = "default_iters_hash" , since = "CURRENT_RUSTC_VERSION" ) ]
1408+ impl < K , V > Default for Iter < ' _ , K , V > {
1409+ #[ inline]
1410+ fn default ( ) -> Self {
1411+ Iter { base : Default :: default ( ) }
1412+ }
1413+ }
1414+
14071415#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
14081416impl < K : Debug , V : Debug > fmt:: Debug for Iter < ' _ , K , V > {
14091417 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -1441,6 +1449,14 @@ impl<'a, K, V> IterMut<'a, K, V> {
14411449 }
14421450}
14431451
1452+ #[ stable( feature = "default_iters_hash" , since = "CURRENT_RUSTC_VERSION" ) ]
1453+ impl < K , V > Default for IterMut < ' _ , K , V > {
1454+ #[ inline]
1455+ fn default ( ) -> Self {
1456+ IterMut { base : Default :: default ( ) }
1457+ }
1458+ }
1459+
14441460/// An owning iterator over the entries of a `HashMap`.
14451461///
14461462/// This `struct` is created by the [`into_iter`] method on [`HashMap`]
@@ -1458,6 +1474,7 @@ impl<'a, K, V> IterMut<'a, K, V> {
14581474/// ]);
14591475/// let iter = map.into_iter();
14601476/// ```
1477+ #[ derive( Clone ) ]
14611478#[ stable( feature = "rust1" , since = "1.0.0" ) ]
14621479pub struct IntoIter < K , V > {
14631480 base : base:: IntoIter < K , V > ,
@@ -1471,6 +1488,14 @@ impl<K, V> IntoIter<K, V> {
14711488 }
14721489}
14731490
1491+ #[ stable( feature = "default_iters_hash" , since = "CURRENT_RUSTC_VERSION" ) ]
1492+ impl < K , V > Default for IntoIter < K , V > {
1493+ #[ inline]
1494+ fn default ( ) -> Self {
1495+ IntoIter { base : Default :: default ( ) }
1496+ }
1497+ }
1498+
14741499/// An iterator over the keys of a `HashMap`.
14751500///
14761501/// This `struct` is created by the [`keys`] method on [`HashMap`]. See its
@@ -1502,6 +1527,14 @@ impl<K, V> Clone for Keys<'_, K, V> {
15021527 }
15031528}
15041529
1530+ #[ stable( feature = "default_iters_hash" , since = "CURRENT_RUSTC_VERSION" ) ]
1531+ impl < K , V > Default for Keys < ' _ , K , V > {
1532+ #[ inline]
1533+ fn default ( ) -> Self {
1534+ Keys { inner : Default :: default ( ) }
1535+ }
1536+ }
1537+
15051538#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
15061539impl < K : Debug , V > fmt:: Debug for Keys < ' _ , K , V > {
15071540 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -1540,6 +1573,14 @@ impl<K, V> Clone for Values<'_, K, V> {
15401573 }
15411574}
15421575
1576+ #[ stable( feature = "default_iters_hash" , since = "CURRENT_RUSTC_VERSION" ) ]
1577+ impl < K , V > Default for Values < ' _ , K , V > {
1578+ #[ inline]
1579+ fn default ( ) -> Self {
1580+ Values { inner : Default :: default ( ) }
1581+ }
1582+ }
1583+
15431584#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
15441585impl < K , V : Debug > fmt:: Debug for Values < ' _ , K , V > {
15451586 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -1626,6 +1667,14 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> {
16261667 inner : IterMut < ' a , K , V > ,
16271668}
16281669
1670+ #[ stable( feature = "default_iters_hash" , since = "CURRENT_RUSTC_VERSION" ) ]
1671+ impl < K , V > Default for ValuesMut < ' _ , K , V > {
1672+ #[ inline]
1673+ fn default ( ) -> Self {
1674+ ValuesMut { inner : Default :: default ( ) }
1675+ }
1676+ }
1677+
16291678/// An owning iterator over the keys of a `HashMap`.
16301679///
16311680/// This `struct` is created by the [`into_keys`] method on [`HashMap`].
@@ -1643,11 +1692,20 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> {
16431692/// ]);
16441693/// let iter_keys = map.into_keys();
16451694/// ```
1695+ #[ derive( Clone ) ]
16461696#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
16471697pub struct IntoKeys < K , V > {
16481698 inner : IntoIter < K , V > ,
16491699}
16501700
1701+ #[ stable( feature = "default_iters_hash" , since = "CURRENT_RUSTC_VERSION" ) ]
1702+ impl < K , V > Default for IntoKeys < K , V > {
1703+ #[ inline]
1704+ fn default ( ) -> Self {
1705+ IntoKeys { inner : Default :: default ( ) }
1706+ }
1707+ }
1708+
16511709/// An owning iterator over the values of a `HashMap`.
16521710///
16531711/// This `struct` is created by the [`into_values`] method on [`HashMap`].
@@ -1665,11 +1723,20 @@ pub struct IntoKeys<K, V> {
16651723/// ]);
16661724/// let iter_keys = map.into_values();
16671725/// ```
1726+ #[ derive( Clone ) ]
16681727#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
16691728pub struct IntoValues < K , V > {
16701729 inner : IntoIter < K , V > ,
16711730}
16721731
1732+ #[ stable( feature = "default_iters_hash" , since = "CURRENT_RUSTC_VERSION" ) ]
1733+ impl < K , V > Default for IntoValues < K , V > {
1734+ #[ inline]
1735+ fn default ( ) -> Self {
1736+ IntoValues { inner : Default :: default ( ) }
1737+ }
1738+ }
1739+
16731740/// A builder for computing where in a HashMap a key-value pair would be stored.
16741741///
16751742/// See the [`HashMap::raw_entry_mut`] docs for usage examples.
0 commit comments