@@ -1404,6 +1404,14 @@ impl<K, V> Clone for Iter<'_, K, V> {
1404
1404
}
1405
1405
}
1406
1406
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
+
1407
1415
#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
1408
1416
impl < K : Debug , V : Debug > fmt:: Debug for Iter < ' _ , K , V > {
1409
1417
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -1441,6 +1449,14 @@ impl<'a, K, V> IterMut<'a, K, V> {
1441
1449
}
1442
1450
}
1443
1451
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
+
1444
1460
/// An owning iterator over the entries of a `HashMap`.
1445
1461
///
1446
1462
/// This `struct` is created by the [`into_iter`] method on [`HashMap`]
@@ -1458,6 +1474,7 @@ impl<'a, K, V> IterMut<'a, K, V> {
1458
1474
/// ]);
1459
1475
/// let iter = map.into_iter();
1460
1476
/// ```
1477
+ #[ derive( Clone ) ]
1461
1478
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1462
1479
pub struct IntoIter < K , V > {
1463
1480
base : base:: IntoIter < K , V > ,
@@ -1471,6 +1488,14 @@ impl<K, V> IntoIter<K, V> {
1471
1488
}
1472
1489
}
1473
1490
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
+
1474
1499
/// An iterator over the keys of a `HashMap`.
1475
1500
///
1476
1501
/// This `struct` is created by the [`keys`] method on [`HashMap`]. See its
@@ -1502,6 +1527,14 @@ impl<K, V> Clone for Keys<'_, K, V> {
1502
1527
}
1503
1528
}
1504
1529
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
+
1505
1538
#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
1506
1539
impl < K : Debug , V > fmt:: Debug for Keys < ' _ , K , V > {
1507
1540
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -1540,6 +1573,14 @@ impl<K, V> Clone for Values<'_, K, V> {
1540
1573
}
1541
1574
}
1542
1575
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
+
1543
1584
#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
1544
1585
impl < K , V : Debug > fmt:: Debug for Values < ' _ , K , V > {
1545
1586
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -1626,6 +1667,14 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> {
1626
1667
inner : IterMut < ' a , K , V > ,
1627
1668
}
1628
1669
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
+
1629
1678
/// An owning iterator over the keys of a `HashMap`.
1630
1679
///
1631
1680
/// This `struct` is created by the [`into_keys`] method on [`HashMap`].
@@ -1643,11 +1692,20 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> {
1643
1692
/// ]);
1644
1693
/// let iter_keys = map.into_keys();
1645
1694
/// ```
1695
+ #[ derive( Clone ) ]
1646
1696
#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
1647
1697
pub struct IntoKeys < K , V > {
1648
1698
inner : IntoIter < K , V > ,
1649
1699
}
1650
1700
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
+
1651
1709
/// An owning iterator over the values of a `HashMap`.
1652
1710
///
1653
1711
/// This `struct` is created by the [`into_values`] method on [`HashMap`].
@@ -1665,11 +1723,20 @@ pub struct IntoKeys<K, V> {
1665
1723
/// ]);
1666
1724
/// let iter_keys = map.into_values();
1667
1725
/// ```
1726
+ #[ derive( Clone ) ]
1668
1727
#[ stable( feature = "map_into_keys_values" , since = "1.54.0" ) ]
1669
1728
pub struct IntoValues < K , V > {
1670
1729
inner : IntoIter < K , V > ,
1671
1730
}
1672
1731
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
+
1673
1740
/// A builder for computing where in a HashMap a key-value pair would be stored.
1674
1741
///
1675
1742
/// See the [`HashMap::raw_entry_mut`] docs for usage examples.
0 commit comments