@@ -1351,13 +1351,37 @@ pub enum Entry<'a, K: 'a, V: 'a> {
1351
1351
) ,
1352
1352
}
1353
1353
1354
+ #[ stable( feature= "debug_hash_map" , since = "1.12.0" ) ]
1355
+ impl < ' a , K : ' a + Debug , V : ' a + Debug > Debug for Entry < ' a , K , V > {
1356
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1357
+ match * self {
1358
+ Vacant ( ref v) => f. debug_tuple ( "Entry" )
1359
+ . field ( v)
1360
+ . finish ( ) ,
1361
+ Occupied ( ref o) => f. debug_tuple ( "Entry" )
1362
+ . field ( o)
1363
+ . finish ( ) ,
1364
+ }
1365
+ }
1366
+ }
1367
+
1354
1368
/// A view into a single occupied location in a HashMap.
1355
1369
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1356
1370
pub struct OccupiedEntry < ' a , K : ' a , V : ' a > {
1357
1371
key : Option < K > ,
1358
1372
elem : FullBucket < K , V , & ' a mut RawTable < K , V > > ,
1359
1373
}
1360
1374
1375
+ #[ stable( feature= "debug_hash_map" , since = "1.12.0" ) ]
1376
+ impl < ' a , K : ' a + Debug , V : ' a + Debug > Debug for OccupiedEntry < ' a , K , V > {
1377
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1378
+ f. debug_struct ( "OccupiedEntry" )
1379
+ . field ( "key" , self . key ( ) )
1380
+ . field ( "value" , self . get ( ) )
1381
+ . finish ( )
1382
+ }
1383
+ }
1384
+
1361
1385
/// A view into a single empty location in a HashMap.
1362
1386
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1363
1387
pub struct VacantEntry < ' a , K : ' a , V : ' a > {
@@ -1366,6 +1390,15 @@ pub struct VacantEntry<'a, K: 'a, V: 'a> {
1366
1390
elem : VacantEntryState < K , V , & ' a mut RawTable < K , V > > ,
1367
1391
}
1368
1392
1393
+ #[ stable( feature= "debug_hash_map" , since = "1.12.0" ) ]
1394
+ impl < ' a , K : ' a + Debug , V : ' a > Debug for VacantEntry < ' a , K , V > {
1395
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1396
+ f. debug_tuple ( "VacantEntry" )
1397
+ . field ( self . key ( ) )
1398
+ . finish ( )
1399
+ }
1400
+ }
1401
+
1369
1402
/// Possible states of a VacantEntry.
1370
1403
enum VacantEntryState < K , V , M > {
1371
1404
/// The index is occupied, but the key to insert has precedence,
0 commit comments