@@ -298,14 +298,23 @@ pub struct IntoIter<K, V> {
298298 length : usize ,
299299}
300300
301- #[ stable( feature = "collection_debug" , since = "1.17.0" ) ]
302- impl < K : fmt:: Debug , V : fmt:: Debug > fmt:: Debug for IntoIter < K , V > {
303- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
301+ impl < K , V > IntoIter < K , V > {
302+ /// Returns an iterator of references over the remaining items.
303+ #[ inline]
304+ pub ( super ) fn iter ( & self ) -> Iter < ' _ , K , V > {
304305 let range = Range {
305306 front : self . front . as_ref ( ) . map ( |f| f. reborrow ( ) ) ,
306307 back : self . back . as_ref ( ) . map ( |b| b. reborrow ( ) ) ,
307308 } ;
308- f. debug_list ( ) . entries ( range) . finish ( )
309+
310+ Iter { range : range, length : self . length }
311+ }
312+ }
313+
314+ #[ stable( feature = "collection_debug" , since = "1.17.0" ) ]
315+ impl < K : fmt:: Debug , V : fmt:: Debug > fmt:: Debug for IntoIter < K , V > {
316+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
317+ f. debug_list ( ) . entries ( self . iter ( ) ) . finish ( )
309318 }
310319}
311320
@@ -364,23 +373,35 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> {
364373///
365374/// [`into_keys`]: BTreeMap::into_keys
366375#[ unstable( feature = "map_into_keys_values" , issue = "75294" ) ]
367- #[ derive( Debug ) ]
368376pub struct IntoKeys < K , V > {
369377 inner : IntoIter < K , V > ,
370378}
371379
380+ #[ unstable( feature = "map_into_keys_values" , issue = "75294" ) ]
381+ impl < K : fmt:: Debug , V > fmt:: Debug for IntoKeys < K , V > {
382+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
383+ f. debug_list ( ) . entries ( self . inner . iter ( ) . map ( |( key, _) | key) ) . finish ( )
384+ }
385+ }
386+
372387/// An owning iterator over the values of a `BTreeMap`.
373388///
374389/// This `struct` is created by the [`into_values`] method on [`BTreeMap`].
375390/// See its documentation for more.
376391///
377392/// [`into_values`]: BTreeMap::into_values
378393#[ unstable( feature = "map_into_keys_values" , issue = "75294" ) ]
379- #[ derive( Debug ) ]
380394pub struct IntoValues < K , V > {
381395 inner : IntoIter < K , V > ,
382396}
383397
398+ #[ unstable( feature = "map_into_keys_values" , issue = "75294" ) ]
399+ impl < K , V : fmt:: Debug > fmt:: Debug for IntoValues < K , V > {
400+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
401+ f. debug_list ( ) . entries ( self . inner . iter ( ) . map ( |( _, val) | val) ) . finish ( )
402+ }
403+ }
404+
384405/// An iterator over a sub-range of entries in a `BTreeMap`.
385406///
386407/// This `struct` is created by the [`range`] method on [`BTreeMap`]. See its
0 commit comments