403
403
}
404
404
405
405
s_no_extra_traits ! {
406
- #[ allow( missing_debug_implementations) ]
407
406
pub struct dirent {
408
407
pub d_ino: :: ino_t,
409
408
pub d_off: :: off_t,
@@ -412,7 +411,6 @@ s_no_extra_traits! {
412
411
pub d_name: [ :: c_char; 256 ] ,
413
412
}
414
413
415
- #[ allow( missing_debug_implementations) ]
416
414
pub struct dirent64 {
417
415
pub d_ino: :: ino64_t,
418
416
pub d_off: :: off64_t,
@@ -421,7 +419,6 @@ s_no_extra_traits! {
421
419
pub d_name: [ :: c_char; 256 ] ,
422
420
}
423
421
424
- #[ allow( missing_debug_implementations) ]
425
422
pub struct sysinfo {
426
423
pub uptime: :: c_ulong,
427
424
pub loads: [ :: c_ulong; 3 ] ,
@@ -440,6 +437,142 @@ s_no_extra_traits! {
440
437
}
441
438
}
442
439
440
+ cfg_if ! {
441
+ if #[ cfg( feature = "extra_traits" ) ] {
442
+ impl PartialEq for dirent {
443
+ fn eq( & self , other: & dirent) -> bool {
444
+ self . d_ino == other. d_ino
445
+ && self . d_off == other. d_off
446
+ && self . d_reclen == other. d_reclen
447
+ && self . d_type == other. d_type
448
+ && self
449
+ . d_name
450
+ . iter( )
451
+ . zip( other. d_name. iter( ) )
452
+ . all( |( a, b) | a == b)
453
+ }
454
+ }
455
+ impl Eq for dirent { }
456
+ impl :: fmt:: Debug for dirent {
457
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
458
+ f. debug_struct( "dirent" )
459
+ . field( "d_ino" , & self . d_ino)
460
+ . field( "d_off" , & self . d_off)
461
+ . field( "d_reclen" , & self . d_reclen)
462
+ . field( "d_type" , & self . d_type)
463
+ // FIXME: .field("d_name", &self.d_name)
464
+ . finish( )
465
+ }
466
+ }
467
+ impl :: hash:: Hash for dirent {
468
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
469
+ self . d_ino. hash( state) ;
470
+ self . d_off. hash( state) ;
471
+ self . d_reclen. hash( state) ;
472
+ self . d_type. hash( state) ;
473
+ self . d_name. hash( state) ;
474
+ }
475
+ }
476
+
477
+ impl PartialEq for dirent64 {
478
+ fn eq( & self , other: & dirent64) -> bool {
479
+ self . d_ino == other. d_ino
480
+ && self . d_off == other. d_off
481
+ && self . d_reclen == other. d_reclen
482
+ && self . d_type == other. d_type
483
+ && self
484
+ . d_name
485
+ . iter( )
486
+ . zip( other. d_name. iter( ) )
487
+ . all( |( a, b) | a == b)
488
+ }
489
+ }
490
+ impl Eq for dirent64 { }
491
+ impl :: fmt:: Debug for dirent64 {
492
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
493
+ f. debug_struct( "dirent64" )
494
+ . field( "d_ino" , & self . d_ino)
495
+ . field( "d_off" , & self . d_off)
496
+ . field( "d_reclen" , & self . d_reclen)
497
+ . field( "d_type" , & self . d_type)
498
+ // FIXME: .field("d_name", &self.d_name)
499
+ . finish( )
500
+ }
501
+ }
502
+ impl :: hash:: Hash for dirent64 {
503
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
504
+ self . d_ino. hash( state) ;
505
+ self . d_off. hash( state) ;
506
+ self . d_reclen. hash( state) ;
507
+ self . d_type. hash( state) ;
508
+ self . d_name. hash( state) ;
509
+ }
510
+ }
511
+
512
+ impl PartialEq for sysinfo {
513
+ fn eq( & self , other: & sysinfo) -> bool {
514
+ self . uptime == other. uptime
515
+ && self . loads == other. loads
516
+ && self . totalram == other. totalram
517
+ && self . freeram == other. freeram
518
+ && self . sharedram == other. sharedram
519
+ && self . bufferram == other. bufferram
520
+ && self . totalswap == other. totalswap
521
+ && self . freeswap == other. freeswap
522
+ && self . procs == other. procs
523
+ && self . pad == other. pad
524
+ && self . totalhigh == other. totalhigh
525
+ && self . freehigh == other. freehigh
526
+ && self . mem_unit == other. mem_unit
527
+ && self
528
+ . __reserved
529
+ . iter( )
530
+ . zip( other. __reserved. iter( ) )
531
+ . all( |( a, b) | a == b)
532
+ }
533
+ }
534
+ impl Eq for sysinfo { }
535
+ impl :: fmt:: Debug for sysinfo {
536
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
537
+ f. debug_struct( "sysinfo" )
538
+ . field( "uptime" , & self . uptime)
539
+ . field( "loads" , & self . loads)
540
+ . field( "totalram" , & self . totalram)
541
+ . field( "freeram" , & self . freeram)
542
+ . field( "sharedram" , & self . sharedram)
543
+ . field( "bufferram" , & self . bufferram)
544
+ . field( "totalswap" , & self . totalswap)
545
+ . field( "freeswap" , & self . freeswap)
546
+ . field( "procs" , & self . procs)
547
+ . field( "pad" , & self . pad)
548
+ . field( "totalhigh" , & self . totalhigh)
549
+ . field( "freehigh" , & self . freehigh)
550
+ . field( "mem_unit" , & self . mem_unit)
551
+ // FIXME: .field("__reserved", &self.__reserved)
552
+ . finish( )
553
+ }
554
+ }
555
+ impl :: hash:: Hash for sysinfo {
556
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
557
+ self . uptime. hash( state) ;
558
+ self . loads. hash( state) ;
559
+ self . totalram. hash( state) ;
560
+ self . freeram. hash( state) ;
561
+ self . sharedram. hash( state) ;
562
+ self . bufferram. hash( state) ;
563
+ self . totalswap. hash( state) ;
564
+ self . freeswap. hash( state) ;
565
+ self . procs. hash( state) ;
566
+ self . pad. hash( state) ;
567
+ self . totalhigh. hash( state) ;
568
+ self . freehigh. hash( state) ;
569
+ self . mem_unit. hash( state) ;
570
+ self . __reserved. hash( state) ;
571
+ }
572
+ }
573
+ }
574
+ }
575
+
443
576
pub const ABDAY_1 : :: nl_item = 0x20000 ;
444
577
pub const ABDAY_2 : :: nl_item = 0x20001 ;
445
578
pub const ABDAY_3 : :: nl_item = 0x20002 ;
0 commit comments