@@ -270,13 +270,41 @@ pub struct Iter<'a, K: 'a, V: 'a> {
270
270
length : usize ,
271
271
}
272
272
273
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
274
+ impl < ' a , K : ' a , V : ' a > fmt:: Debug for Iter < ' a , K , V > {
275
+ default fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
276
+ f. pad ( "BTreeMap::Iter { .. }" )
277
+ }
278
+ }
279
+
280
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
281
+ impl < ' a , K : ' a + fmt:: Debug , V : ' a + fmt:: Debug > fmt:: Debug for Iter < ' a , K , V > {
282
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
283
+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
284
+ }
285
+ }
286
+
273
287
/// A mutable iterator over a BTreeMap's entries.
274
288
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
275
289
pub struct IterMut < ' a , K : ' a , V : ' a > {
276
290
range : RangeMut < ' a , K , V > ,
277
291
length : usize ,
278
292
}
279
293
294
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
295
+ impl < ' a , K : ' a , V : ' a > fmt:: Debug for IterMut < ' a , K , V > {
296
+ default fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
297
+ f. pad ( "BTreeMap::IterMut { .. }" )
298
+ }
299
+ }
300
+
301
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
302
+ impl < ' a , K : ' a + fmt:: Debug , V : ' a + fmt:: Debug > fmt:: Debug for IterMut < ' a , K , V > {
303
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
304
+ f. pad ( & format ! ( "BTreeMap::IterMut({:?})" , self . range) )
305
+ }
306
+ }
307
+
280
308
/// An owning iterator over a BTreeMap's entries.
281
309
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
282
310
pub struct IntoIter < K , V > {
@@ -285,30 +313,104 @@ pub struct IntoIter<K, V> {
285
313
length : usize ,
286
314
}
287
315
316
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
317
+ impl < K , V > fmt:: Debug for IntoIter < K , V > {
318
+ default fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
319
+ f. pad ( "BTreeMap::IntoIter { .. }" )
320
+ }
321
+ }
322
+
323
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
324
+ impl < K : fmt:: Debug , V : fmt:: Debug > fmt:: Debug for IntoIter < K , V > {
325
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
326
+ let range = Range {
327
+ front : self . front . reborrow ( ) ,
328
+ back : self . back . reborrow ( ) ,
329
+ } ;
330
+ f. debug_list ( ) . entries ( range) . finish ( )
331
+ }
332
+ }
333
+
288
334
/// An iterator over a BTreeMap's keys.
289
335
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
290
336
pub struct Keys < ' a , K : ' a , V : ' a > {
291
337
inner : Iter < ' a , K , V > ,
292
338
}
293
339
340
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
341
+ impl < ' a , K : ' a , V : ' a > fmt:: Debug for Keys < ' a , K , V > {
342
+ default fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
343
+ f. pad ( "BTreeMap::Keys { .. }" )
344
+ }
345
+ }
346
+
347
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
348
+ impl < ' a , K : ' a + fmt:: Debug , V : ' a + fmt:: Debug > fmt:: Debug for Keys < ' a , K , V > {
349
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
350
+ f. debug_list ( ) . entries ( self . inner . clone ( ) ) . finish ( )
351
+ }
352
+ }
353
+
294
354
/// An iterator over a BTreeMap's values.
295
355
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
296
356
pub struct Values < ' a , K : ' a , V : ' a > {
297
357
inner : Iter < ' a , K , V > ,
298
358
}
299
359
360
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
361
+ impl < ' a , K : ' a , V : ' a > fmt:: Debug for Values < ' a , K , V > {
362
+ default fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
363
+ f. pad ( "BTreeMap::Values { .. }" )
364
+ }
365
+ }
366
+
367
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
368
+ impl < ' a , K : ' a + fmt:: Debug , V : ' a + fmt:: Debug > fmt:: Debug for Values < ' a , K , V > {
369
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
370
+ f. debug_list ( ) . entries ( self . inner . clone ( ) ) . finish ( )
371
+ }
372
+ }
373
+
300
374
/// A mutable iterator over a BTreeMap's values.
301
375
#[ stable( feature = "map_values_mut" , since = "1.10.0" ) ]
302
376
pub struct ValuesMut < ' a , K : ' a , V : ' a > {
303
377
inner : IterMut < ' a , K , V > ,
304
378
}
305
379
380
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
381
+ impl < ' a , K : ' a , V : ' a > fmt:: Debug for ValuesMut < ' a , K , V > {
382
+ default fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
383
+ f. pad ( "BTreeMap::ValuesMut { .. }" )
384
+ }
385
+ }
386
+
387
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
388
+ impl < ' a , K : ' a + fmt:: Debug , V : ' a + fmt:: Debug > fmt:: Debug for ValuesMut < ' a , K , V > {
389
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
390
+ f. pad ( & format ! ( "BTreeMap::ValuesMut({:?})" , self . inner) )
391
+ }
392
+ }
393
+
306
394
/// An iterator over a sub-range of BTreeMap's entries.
307
395
pub struct Range < ' a , K : ' a , V : ' a > {
308
396
front : Handle < NodeRef < marker:: Immut < ' a > , K , V , marker:: Leaf > , marker:: Edge > ,
309
397
back : Handle < NodeRef < marker:: Immut < ' a > , K , V , marker:: Leaf > , marker:: Edge > ,
310
398
}
311
399
400
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
401
+ impl < ' a , K : ' a , V : ' a > fmt:: Debug for Range < ' a , K , V > {
402
+ default fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
403
+ f. pad ( "BTreeMap::Range { .. }" )
404
+ }
405
+ }
406
+
407
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
408
+ impl < ' a , K : ' a + fmt:: Debug , V : ' a + fmt:: Debug > fmt:: Debug for Range < ' a , K , V > {
409
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
410
+ f. debug_list ( ) . entries ( self . clone ( ) ) . finish ( )
411
+ }
412
+ }
413
+
312
414
/// A mutable iterator over a sub-range of BTreeMap's entries.
313
415
pub struct RangeMut < ' a , K : ' a , V : ' a > {
314
416
front : Handle < NodeRef < marker:: Mut < ' a > , K , V , marker:: Leaf > , marker:: Edge > ,
@@ -318,6 +420,24 @@ pub struct RangeMut<'a, K: 'a, V: 'a> {
318
420
_marker : PhantomData < & ' a mut ( K , V ) > ,
319
421
}
320
422
423
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
424
+ impl < ' a , K : ' a , V : ' a > fmt:: Debug for RangeMut < ' a , K , V > {
425
+ default fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
426
+ f. pad ( "BTreeMap::RangeMut { .. }" )
427
+ }
428
+ }
429
+
430
+ #[ stable( feature = "collection_debug" , since = "1.15.0" ) ]
431
+ impl < ' a , K : ' a + fmt:: Debug , V : ' a + fmt:: Debug > fmt:: Debug for RangeMut < ' a , K , V > {
432
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
433
+ let range = Range {
434
+ front : self . front . reborrow ( ) ,
435
+ back : self . back . reborrow ( ) ,
436
+ } ;
437
+ f. debug_list ( ) . entries ( range) . finish ( )
438
+ }
439
+ }
440
+
321
441
/// A view into a single entry in a map, which may either be vacant or occupied.
322
442
/// This enum is constructed from the [`entry`] method on [`BTreeMap`].
323
443
///
0 commit comments