@@ -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`]
@@ -1471,6 +1487,14 @@ impl<K, V> IntoIter<K, V> {
1471
1487
}
1472
1488
}
1473
1489
1490
+ #[ stable( feature = "default_iters_hash" , since = "CURRENT_RUSTC_VERSION" ) ]
1491
+ impl < K , V > Default for IntoIter < K , V > {
1492
+ #[ inline]
1493
+ fn default ( ) -> Self {
1494
+ IntoIter { base : Default :: default ( ) }
1495
+ }
1496
+ }
1497
+
1474
1498
/// An iterator over the keys of a `HashMap`.
1475
1499
///
1476
1500
/// This `struct` is created by the [`keys`] method on [`HashMap`]. See its
@@ -1502,6 +1526,14 @@ impl<K, V> Clone for Keys<'_, K, V> {
1502
1526
}
1503
1527
}
1504
1528
1529
+ #[ stable( feature = "default_iters_hash" , since = "CURRENT_RUSTC_VERSION" ) ]
1530
+ impl < K , V > Default for Keys < ' _ , K , V > {
1531
+ #[ inline]
1532
+ fn default ( ) -> Self {
1533
+ Keys { inner : Default :: default ( ) }
1534
+ }
1535
+ }
1536
+
1505
1537
#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
1506
1538
impl < K : Debug , V > fmt:: Debug for Keys < ' _ , K , V > {
1507
1539
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -1540,6 +1572,14 @@ impl<K, V> Clone for Values<'_, K, V> {
1540
1572
}
1541
1573
}
1542
1574
1575
+ #[ stable( feature = "default_iters_hash" , since = "CURRENT_RUSTC_VERSION" ) ]
1576
+ impl < K , V > Default for Values < ' _ , K , V > {
1577
+ #[ inline]
1578
+ fn default ( ) -> Self {
1579
+ Values { inner : Default :: default ( ) }
1580
+ }
1581
+ }
1582
+
1543
1583
#[ stable( feature = "std_debug" , since = "1.16.0" ) ]
1544
1584
impl < K , V : Debug > fmt:: Debug for Values < ' _ , K , V > {
1545
1585
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -1626,6 +1666,14 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> {
1626
1666
inner : IterMut < ' a , K , V > ,
1627
1667
}
1628
1668
1669
+ #[ stable( feature = "default_iters_hash" , since = "CURRENT_RUSTC_VERSION" ) ]
1670
+ impl < K , V > Default for ValuesMut < ' _ , K , V > {
1671
+ #[ inline]
1672
+ fn default ( ) -> Self {
1673
+ ValuesMut { inner : Default :: default ( ) }
1674
+ }
1675
+ }
1676
+
1629
1677
/// An owning iterator over the keys of a `HashMap`.
1630
1678
///
1631
1679
/// This `struct` is created by the [`into_keys`] method on [`HashMap`].
@@ -1648,6 +1696,14 @@ pub struct IntoKeys<K, V> {
1648
1696
inner : IntoIter < K , V > ,
1649
1697
}
1650
1698
1699
+ #[ stable( feature = "default_iters_hash" , since = "CURRENT_RUSTC_VERSION" ) ]
1700
+ impl < K , V > Default for IntoKeys < K , V > {
1701
+ #[ inline]
1702
+ fn default ( ) -> Self {
1703
+ IntoKeys { inner : Default :: default ( ) }
1704
+ }
1705
+ }
1706
+
1651
1707
/// An owning iterator over the values of a `HashMap`.
1652
1708
///
1653
1709
/// This `struct` is created by the [`into_values`] method on [`HashMap`].
@@ -1670,6 +1726,14 @@ pub struct IntoValues<K, V> {
1670
1726
inner : IntoIter < K , V > ,
1671
1727
}
1672
1728
1729
+ #[ stable( feature = "default_iters_hash" , since = "CURRENT_RUSTC_VERSION" ) ]
1730
+ impl < K , V > Default for IntoValues < K , V > {
1731
+ #[ inline]
1732
+ fn default ( ) -> Self {
1733
+ IntoValues { inner : Default :: default ( ) }
1734
+ }
1735
+ }
1736
+
1673
1737
/// A builder for computing where in a HashMap a key-value pair would be stored.
1674
1738
///
1675
1739
/// See the [`HashMap::raw_entry_mut`] docs for usage examples.
0 commit comments