@@ -1193,6 +1193,11 @@ impl<'a, K: 'a, V: 'a> Iterator for Iter<'a, K, V> {
1193
1193
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
1194
1194
( self . length , Some ( self . length ) )
1195
1195
}
1196
+
1197
+ #[ inline]
1198
+ fn last ( mut self ) -> Option < ( & ' a K , & ' a V ) > {
1199
+ self . next_back ( )
1200
+ }
1196
1201
}
1197
1202
1198
1203
#[ stable( feature = "fused" , since = "1.26.0" ) ]
@@ -1253,6 +1258,11 @@ impl<'a, K: 'a, V: 'a> Iterator for IterMut<'a, K, V> {
1253
1258
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
1254
1259
( self . length , Some ( self . length ) )
1255
1260
}
1261
+
1262
+ #[ inline]
1263
+ fn last ( mut self ) -> Option < ( & ' a K , & ' a mut V ) > {
1264
+ self . next_back ( )
1265
+ }
1256
1266
}
1257
1267
1258
1268
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -1359,6 +1369,11 @@ impl<K, V> Iterator for IntoIter<K, V> {
1359
1369
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
1360
1370
( self . length , Some ( self . length ) )
1361
1371
}
1372
+
1373
+ #[ inline]
1374
+ fn last ( mut self ) -> Option < ( K , V ) > {
1375
+ self . next_back ( )
1376
+ }
1362
1377
}
1363
1378
1364
1379
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -1421,6 +1436,11 @@ impl<'a, K, V> Iterator for Keys<'a, K, V> {
1421
1436
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
1422
1437
self . inner . size_hint ( )
1423
1438
}
1439
+
1440
+ #[ inline]
1441
+ fn last ( mut self ) -> Option < & ' a K > {
1442
+ self . next_back ( )
1443
+ }
1424
1444
}
1425
1445
1426
1446
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -1458,6 +1478,11 @@ impl<'a, K, V> Iterator for Values<'a, K, V> {
1458
1478
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
1459
1479
self . inner . size_hint ( )
1460
1480
}
1481
+
1482
+ #[ inline]
1483
+ fn last ( mut self ) -> Option < & ' a V > {
1484
+ self . next_back ( )
1485
+ }
1461
1486
}
1462
1487
1463
1488
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -1495,6 +1520,11 @@ impl<'a, K, V> Iterator for Range<'a, K, V> {
1495
1520
unsafe { Some ( self . next_unchecked ( ) ) }
1496
1521
}
1497
1522
}
1523
+
1524
+ #[ inline]
1525
+ fn last ( mut self ) -> Option < ( & ' a K , & ' a V ) > {
1526
+ self . next_back ( )
1527
+ }
1498
1528
}
1499
1529
1500
1530
#[ stable( feature = "map_values_mut" , since = "1.10.0" ) ]
@@ -1508,6 +1538,11 @@ impl<'a, K, V> Iterator for ValuesMut<'a, K, V> {
1508
1538
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
1509
1539
self . inner . size_hint ( )
1510
1540
}
1541
+
1542
+ #[ inline]
1543
+ fn last ( mut self ) -> Option < & ' a mut V > {
1544
+ self . next_back ( )
1545
+ }
1511
1546
}
1512
1547
1513
1548
#[ stable( feature = "map_values_mut" , since = "1.10.0" ) ]
@@ -1626,6 +1661,11 @@ impl<'a, K, V> Iterator for RangeMut<'a, K, V> {
1626
1661
unsafe { Some ( self . next_unchecked ( ) ) }
1627
1662
}
1628
1663
}
1664
+
1665
+ #[ inline]
1666
+ fn last ( mut self ) -> Option < ( & ' a K , & ' a mut V ) > {
1667
+ self . next_back ( )
1668
+ }
1629
1669
}
1630
1670
1631
1671
impl < ' a , K , V > RangeMut < ' a , K , V > {
0 commit comments