@@ -298,14 +298,23 @@ pub struct IntoIter<K, V> {
298
298
length : usize ,
299
299
}
300
300
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 > {
304
305
let range = Range {
305
306
front : self . front . as_ref ( ) . map ( |f| f. reborrow ( ) ) ,
306
307
back : self . back . as_ref ( ) . map ( |b| b. reborrow ( ) ) ,
307
308
} ;
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 ( )
309
318
}
310
319
}
311
320
@@ -364,23 +373,35 @@ pub struct ValuesMut<'a, K: 'a, V: 'a> {
364
373
///
365
374
/// [`into_keys`]: BTreeMap::into_keys
366
375
#[ unstable( feature = "map_into_keys_values" , issue = "75294" ) ]
367
- #[ derive( Debug ) ]
368
376
pub struct IntoKeys < K , V > {
369
377
inner : IntoIter < K , V > ,
370
378
}
371
379
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
+
372
387
/// An owning iterator over the values of a `BTreeMap`.
373
388
///
374
389
/// This `struct` is created by the [`into_values`] method on [`BTreeMap`].
375
390
/// See its documentation for more.
376
391
///
377
392
/// [`into_values`]: BTreeMap::into_values
378
393
#[ unstable( feature = "map_into_keys_values" , issue = "75294" ) ]
379
- #[ derive( Debug ) ]
380
394
pub struct IntoValues < K , V > {
381
395
inner : IntoIter < K , V > ,
382
396
}
383
397
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
+
384
405
/// An iterator over a sub-range of entries in a `BTreeMap`.
385
406
///
386
407
/// This `struct` is created by the [`range`] method on [`BTreeMap`]. See its
0 commit comments