@@ -361,11 +361,17 @@ impl<K, V: fmt::Debug> fmt::Debug for Values<'_, K, V> {
361361///
362362/// [`values_mut`]: BTreeMap::values_mut
363363#[ stable( feature = "map_values_mut" , since = "1.10.0" ) ]
364- #[ derive( Debug ) ]
365364pub struct ValuesMut < ' a , K : ' a , V : ' a > {
366365 inner : IterMut < ' a , K , V > ,
367366}
368367
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+
369375/// An owning iterator over the keys of a `BTreeMap`.
370376///
371377/// This `struct` is created by the [`into_keys`] method on [`BTreeMap`].
@@ -1519,6 +1525,14 @@ impl<K, V> ExactSizeIterator for IterMut<'_, K, V> {
15191525#[ stable( feature = "fused" , since = "1.26.0" ) ]
15201526impl < K , V > FusedIterator for IterMut < ' _ , K , V > { }
15211527
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+
15221536#[ stable( feature = "rust1" , since = "1.0.0" ) ]
15231537impl < K , V > IntoIterator for BTreeMap < K , V > {
15241538 type Item = ( K , V ) ;
@@ -2006,6 +2020,15 @@ impl<'a, K, V> RangeMut<'a, K, V> {
20062020 unsafe fn next_unchecked ( & mut self ) -> ( & ' a mut K , & ' a mut V ) {
20072021 unsafe { unwrap_unchecked ( self . front . as_mut ( ) ) . next_unchecked ( ) }
20082022 }
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+ }
20092032}
20102033
20112034#[ stable( feature = "btree_range" , since = "1.17.0" ) ]
0 commit comments