@@ -361,11 +361,17 @@ impl<K, V: fmt::Debug> fmt::Debug for Values<'_, K, V> {
361
361
///
362
362
/// [`values_mut`]: BTreeMap::values_mut
363
363
#[ stable( feature = "map_values_mut" , since = "1.10.0" ) ]
364
- #[ derive( Debug ) ]
365
364
pub struct ValuesMut < ' a , K : ' a , V : ' a > {
366
365
inner : IterMut < ' a , K , V > ,
367
366
}
368
367
368
+ #[ stable( feature = "map_values_mut" , since = "1.10.0" ) ]
369
+ impl < K , V : fmt:: Debug > fmt:: Debug for ValuesMut < ' _ , K , V > {
370
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
371
+ f. debug_list ( ) . entries ( self . inner . iter ( ) . map ( |( _, val) | val) ) . finish ( )
372
+ }
373
+ }
374
+
369
375
/// An owning iterator over the keys of a `BTreeMap`.
370
376
///
371
377
/// This `struct` is created by the [`into_keys`] method on [`BTreeMap`].
@@ -1519,6 +1525,14 @@ impl<K, V> ExactSizeIterator for IterMut<'_, K, V> {
1519
1525
#[ stable( feature = "fused" , since = "1.26.0" ) ]
1520
1526
impl < K , V > FusedIterator for IterMut < ' _ , K , V > { }
1521
1527
1528
+ impl < ' a , K , V > IterMut < ' a , K , V > {
1529
+ /// Returns an iterator of references over the remaining items.
1530
+ #[ inline]
1531
+ pub ( super ) fn iter ( & self ) -> Iter < ' _ , K , V > {
1532
+ Iter { range : self . range . iter ( ) , length : self . length }
1533
+ }
1534
+ }
1535
+
1522
1536
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1523
1537
impl < K , V > IntoIterator for BTreeMap < K , V > {
1524
1538
type Item = ( K , V ) ;
@@ -2006,6 +2020,15 @@ impl<'a, K, V> RangeMut<'a, K, V> {
2006
2020
unsafe fn next_unchecked ( & mut self ) -> ( & ' a mut K , & ' a mut V ) {
2007
2021
unsafe { unwrap_unchecked ( self . front . as_mut ( ) ) . next_unchecked ( ) }
2008
2022
}
2023
+
2024
+ /// Returns an iterator of references over the remaining items.
2025
+ #[ inline]
2026
+ pub ( super ) fn iter ( & self ) -> Range < ' _ , K , V > {
2027
+ Range {
2028
+ front : self . front . as_ref ( ) . map ( |f| f. reborrow ( ) ) ,
2029
+ back : self . back . as_ref ( ) . map ( |b| b. reborrow ( ) ) ,
2030
+ }
2031
+ }
2009
2032
}
2010
2033
2011
2034
#[ stable( feature = "btree_range" , since = "1.17.0" ) ]
0 commit comments