@@ -274,14 +274,12 @@ s! {
274
274
}
275
275
276
276
s_no_extra_traits ! {
277
- #[ allow( missing_debug_implementations) ]
278
277
pub struct in_pktinfo {
279
278
pub ipi_addr: :: in_addr,
280
279
pub ipi_ifindex: :: c_uint,
281
280
}
282
281
283
282
#[ repr( packed) ]
284
- #[ allow( missing_debug_implementations) ]
285
283
pub struct arphdr {
286
284
pub ar_hrd: u16 ,
287
285
pub ar_pro: u16 ,
@@ -291,18 +289,15 @@ s_no_extra_traits! {
291
289
}
292
290
293
291
#[ repr( packed) ]
294
- #[ allow( missing_debug_implementations) ]
295
292
pub struct in_addr {
296
293
pub s_addr: :: in_addr_t,
297
294
}
298
295
299
- #[ allow( missing_debug_implementations) ]
300
296
pub struct ip_mreq {
301
297
pub imr_multiaddr: in_addr,
302
298
pub imr_interface: in_addr,
303
299
}
304
300
305
- #[ allow( missing_debug_implementations) ]
306
301
pub struct sockaddr_in {
307
302
pub sin_len: u8 ,
308
303
pub sin_family: :: sa_family_t,
@@ -311,7 +306,6 @@ s_no_extra_traits! {
311
306
pub sin_zero: [ :: int8_t; 8 ] ,
312
307
}
313
308
314
- #[ allow( missing_debug_implementations) ]
315
309
pub struct dirent {
316
310
pub d_fileno: :: ino_t,
317
311
pub d_reclen: u16 ,
@@ -320,7 +314,6 @@ s_no_extra_traits! {
320
314
pub d_name: [ :: c_char; 512 ] ,
321
315
}
322
316
323
- #[ allow( missing_debug_implementations) ]
324
317
pub struct statvfs {
325
318
pub f_flag: :: c_ulong,
326
319
pub f_bsize: :: c_ulong,
@@ -355,7 +348,6 @@ s_no_extra_traits! {
355
348
pub f_mntfromname: [ :: c_char; 1024 ] ,
356
349
}
357
350
358
- #[ allow( missing_debug_implementations) ]
359
351
pub struct sockaddr_storage {
360
352
pub ss_len: u8 ,
361
353
pub ss_family: :: sa_family_t,
@@ -365,6 +357,309 @@ s_no_extra_traits! {
365
357
}
366
358
}
367
359
360
+ cfg_if ! {
361
+ if #[ cfg( feature = "extra_traits" ) ] {
362
+ impl PartialEq for in_pktinfo {
363
+ fn eq( & self , other: & in_pktinfo) -> bool {
364
+ self . ipi_addr == other. ipi_addr
365
+ && self . ipi_ifindex == other. ipi_ifindex
366
+ }
367
+ }
368
+ impl Eq for in_pktinfo { }
369
+ impl :: fmt:: Debug for in_pktinfo {
370
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
371
+ f. debug_struct( "in_pktinfo" )
372
+ . field( "ipi_addr" , & self . ipi_addr)
373
+ . field( "ipi_ifindex" , & self . ipi_ifindex)
374
+ . finish( )
375
+ }
376
+ }
377
+ impl :: hash:: Hash for in_pktinfo {
378
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
379
+ self . ipi_addr. hash( state) ;
380
+ self . ipi_ifindex. hash( state) ;
381
+ }
382
+ }
383
+
384
+ impl PartialEq for arphdr {
385
+ fn eq( & self , other: & arphdr) -> bool {
386
+ self . ar_hrd == other. ar_hrd
387
+ && self . ar_pro == other. ar_pro
388
+ && self . ar_hln == other. ar_hln
389
+ && self . ar_pln == other. ar_pln
390
+ && self . ar_op == other. ar_op
391
+ }
392
+ }
393
+ impl Eq for arphdr { }
394
+ impl :: fmt:: Debug for arphdr {
395
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
396
+ let ar_hrd = self . ar_hrd;
397
+ let ar_pro = self . ar_pro;
398
+ let ar_op = self . ar_op;
399
+ f. debug_struct( "arphdr" )
400
+ . field( "ar_hrd" , & ar_hrd)
401
+ . field( "ar_pro" , & ar_pro)
402
+ . field( "ar_hln" , & self . ar_hln)
403
+ . field( "ar_pln" , & self . ar_pln)
404
+ . field( "ar_op" , & ar_op)
405
+ . finish( )
406
+ }
407
+ }
408
+ impl :: hash:: Hash for arphdr {
409
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
410
+ let ar_hrd = self . ar_hrd;
411
+ let ar_pro = self . ar_pro;
412
+ let ar_op = self . ar_op;
413
+ ar_hrd. hash( state) ;
414
+ ar_pro. hash( state) ;
415
+ self . ar_hln. hash( state) ;
416
+ self . ar_pln. hash( state) ;
417
+ ar_op. hash( state) ;
418
+ }
419
+ }
420
+
421
+ impl PartialEq for in_addr {
422
+ fn eq( & self , other: & in_addr) -> bool {
423
+ self . s_addr == other. s_addr
424
+ }
425
+ }
426
+ impl Eq for in_addr { }
427
+ impl :: fmt:: Debug for in_addr {
428
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
429
+ let s_addr = self . s_addr;
430
+ f. debug_struct( "in_addr" )
431
+ . field( "s_addr" , & s_addr)
432
+ . finish( )
433
+ }
434
+ }
435
+ impl :: hash:: Hash for in_addr {
436
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
437
+ let s_addr = self . s_addr;
438
+ s_addr. hash( state) ;
439
+ }
440
+ }
441
+
442
+ impl PartialEq for ip_mreq {
443
+ fn eq( & self , other: & ip_mreq) -> bool {
444
+ self . imr_multiaddr == other. imr_multiaddr
445
+ && self . imr_interface == other. imr_interface
446
+ }
447
+ }
448
+ impl Eq for ip_mreq { }
449
+ impl :: fmt:: Debug for ip_mreq {
450
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
451
+ f. debug_struct( "ip_mreq" )
452
+ . field( "imr_multiaddr" , & self . imr_multiaddr)
453
+ . field( "imr_interface" , & self . imr_interface)
454
+ . finish( )
455
+ }
456
+ }
457
+ impl :: hash:: Hash for ip_mreq {
458
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
459
+ self . imr_multiaddr. hash( state) ;
460
+ self . imr_interface. hash( state) ;
461
+ }
462
+ }
463
+
464
+ impl PartialEq for sockaddr_in {
465
+ fn eq( & self , other: & sockaddr_in) -> bool {
466
+ self . sin_len == other. sin_len
467
+ && self . sin_family == other. sin_family
468
+ && self . sin_port == other. sin_port
469
+ && self . sin_addr == other. sin_addr
470
+ && self . sin_zero == other. sin_zero
471
+ }
472
+ }
473
+ impl Eq for sockaddr_in { }
474
+ impl :: fmt:: Debug for sockaddr_in {
475
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
476
+ f. debug_struct( "sockaddr_in" )
477
+ . field( "sin_len" , & self . sin_len)
478
+ . field( "sin_family" , & self . sin_family)
479
+ . field( "sin_port" , & self . sin_port)
480
+ . field( "sin_addr" , & self . sin_addr)
481
+ . field( "sin_zero" , & self . sin_zero)
482
+ . finish( )
483
+ }
484
+ }
485
+ impl :: hash:: Hash for sockaddr_in {
486
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
487
+ self . sin_len. hash( state) ;
488
+ self . sin_family. hash( state) ;
489
+ self . sin_port. hash( state) ;
490
+ self . sin_addr. hash( state) ;
491
+ self . sin_zero. hash( state) ;
492
+ }
493
+ }
494
+
495
+ impl PartialEq for dirent {
496
+ fn eq( & self , other: & dirent) -> bool {
497
+ self . d_fileno == other. d_fileno
498
+ && self . d_reclen == other. d_reclen
499
+ && self . d_namlen == other. d_namlen
500
+ && self . d_type == other. d_type
501
+ && self
502
+ . d_name
503
+ . iter( )
504
+ . zip( other. d_name. iter( ) )
505
+ . all( |( a, b) | a == b)
506
+ }
507
+ }
508
+ impl Eq for dirent { }
509
+ impl :: fmt:: Debug for dirent {
510
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
511
+ f. debug_struct( "dirent" )
512
+ . field( "d_fileno" , & self . d_fileno)
513
+ . field( "d_reclen" , & self . d_reclen)
514
+ . field( "d_namlen" , & self . d_namlen)
515
+ . field( "d_type" , & self . d_type)
516
+ // FIXME: .field("d_name", &self.d_name)
517
+ . finish( )
518
+ }
519
+ }
520
+ impl :: hash:: Hash for dirent {
521
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
522
+ self . d_fileno. hash( state) ;
523
+ self . d_reclen. hash( state) ;
524
+ self . d_namlen. hash( state) ;
525
+ self . d_type. hash( state) ;
526
+ self . d_name. hash( state) ;
527
+ }
528
+ }
529
+
530
+ impl PartialEq for statvfs {
531
+ fn eq( & self , other: & statvfs) -> bool {
532
+ self . f_flag == other. f_flag
533
+ && self . f_bsize == other. f_bsize
534
+ && self . f_frsize == other. f_frsize
535
+ && self . f_iosize == other. f_iosize
536
+ && self . f_blocks == other. f_blocks
537
+ && self . f_bfree == other. f_bfree
538
+ && self . f_bavail == other. f_bavail
539
+ && self . f_bresvd == other. f_bresvd
540
+ && self . f_files == other. f_files
541
+ && self . f_ffree == other. f_ffree
542
+ && self . f_favail == other. f_favail
543
+ && self . f_fresvd == other. f_fresvd
544
+ && self . f_syncreads == other. f_syncreads
545
+ && self . f_syncwrites == other. f_syncwrites
546
+ && self . f_asyncreads == other. f_asyncreads
547
+ && self . f_asyncwrites == other. f_asyncwrites
548
+ && self . f_fsidx == other. f_fsidx
549
+ && self . f_fsid == other. f_fsid
550
+ && self . f_namemax == other. f_namemax
551
+ && self . f_owner == other. f_owner
552
+ && self . f_spare == other. f_spare
553
+ && self . f_fstypename == other. f_fstypename
554
+ && self
555
+ . f_mntonname
556
+ . iter( )
557
+ . zip( other. f_mntonname. iter( ) )
558
+ . all( |( a, b) | a == b)
559
+ && self
560
+ . f_mntfromname
561
+ . iter( )
562
+ . zip( other. f_mntfromname. iter( ) )
563
+ . all( |( a, b) | a == b)
564
+ }
565
+ }
566
+ impl Eq for statvfs { }
567
+ impl :: fmt:: Debug for statvfs {
568
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
569
+ f. debug_struct( "statvfs" )
570
+ . field( "f_flag" , & self . f_flag)
571
+ . field( "f_bsize" , & self . f_bsize)
572
+ . field( "f_frsize" , & self . f_frsize)
573
+ . field( "f_iosize" , & self . f_iosize)
574
+ . field( "f_blocks" , & self . f_blocks)
575
+ . field( "f_bfree" , & self . f_bfree)
576
+ . field( "f_bavail" , & self . f_bavail)
577
+ . field( "f_bresvd" , & self . f_bresvd)
578
+ . field( "f_files" , & self . f_files)
579
+ . field( "f_ffree" , & self . f_ffree)
580
+ . field( "f_favail" , & self . f_favail)
581
+ . field( "f_fresvd" , & self . f_fresvd)
582
+ . field( "f_syncreads" , & self . f_syncreads)
583
+ . field( "f_syncwrites" , & self . f_syncwrites)
584
+ . field( "f_asyncreads" , & self . f_asyncreads)
585
+ . field( "f_asyncwrites" , & self . f_asyncwrites)
586
+ . field( "f_fsidx" , & self . f_fsidx)
587
+ . field( "f_fsid" , & self . f_fsid)
588
+ . field( "f_namemax" , & self . f_namemax)
589
+ . field( "f_owner" , & self . f_owner)
590
+ . field( "f_spare" , & self . f_spare)
591
+ . field( "f_fstypename" , & self . f_fstypename)
592
+ // FIXME: .field("f_mntonname", &self.f_mntonname)
593
+ // FIXME: .field("f_mntfromname", &self.f_mntfromname)
594
+ . finish( )
595
+ }
596
+ }
597
+ impl :: hash:: Hash for statvfs {
598
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
599
+ self . f_flag. hash( state) ;
600
+ self . f_bsize. hash( state) ;
601
+ self . f_frsize. hash( state) ;
602
+ self . f_iosize. hash( state) ;
603
+ self . f_blocks. hash( state) ;
604
+ self . f_bfree. hash( state) ;
605
+ self . f_bavail. hash( state) ;
606
+ self . f_bresvd. hash( state) ;
607
+ self . f_files. hash( state) ;
608
+ self . f_ffree. hash( state) ;
609
+ self . f_favail. hash( state) ;
610
+ self . f_fresvd. hash( state) ;
611
+ self . f_syncreads. hash( state) ;
612
+ self . f_syncwrites. hash( state) ;
613
+ self . f_asyncreads. hash( state) ;
614
+ self . f_asyncwrites. hash( state) ;
615
+ self . f_fsidx. hash( state) ;
616
+ self . f_fsid. hash( state) ;
617
+ self . f_namemax. hash( state) ;
618
+ self . f_owner. hash( state) ;
619
+ self . f_spare. hash( state) ;
620
+ self . f_fstypename. hash( state) ;
621
+ self . f_mntonname. hash( state) ;
622
+ self . f_mntfromname. hash( state) ;
623
+ }
624
+ }
625
+
626
+ impl PartialEq for sockaddr_storage {
627
+ fn eq( & self , other: & sockaddr_storage) -> bool {
628
+ self . ss_len == other. ss_len
629
+ && self . ss_family == other. ss_family
630
+ && self . __ss_pad1 == other. __ss_pad1
631
+ && self . __ss_pad2 == other. __ss_pad2
632
+ && self
633
+ . __ss_pad3
634
+ . iter( )
635
+ . zip( other. __ss_pad3. iter( ) )
636
+ . all( |( a, b) | a == b)
637
+ }
638
+ }
639
+ impl Eq for sockaddr_storage { }
640
+ impl :: fmt:: Debug for sockaddr_storage {
641
+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
642
+ f. debug_struct( "sockaddr_storage" )
643
+ . field( "ss_len" , & self . ss_len)
644
+ . field( "ss_family" , & self . ss_family)
645
+ . field( "__ss_pad1" , & self . __ss_pad1)
646
+ . field( "__ss_pad2" , & self . __ss_pad2)
647
+ // FIXME: .field("__ss_pad3", &self.__ss_pad3)
648
+ . finish( )
649
+ }
650
+ }
651
+ impl :: hash:: Hash for sockaddr_storage {
652
+ fn hash<H : :: hash:: Hasher >( & self , state: & mut H ) {
653
+ self . ss_len. hash( state) ;
654
+ self . ss_family. hash( state) ;
655
+ self . __ss_pad1. hash( state) ;
656
+ self . __ss_pad2. hash( state) ;
657
+ self . __ss_pad3. hash( state) ;
658
+ }
659
+ }
660
+ }
661
+ }
662
+
368
663
pub const AT_FDCWD : :: c_int = -100 ;
369
664
pub const AT_EACCESS : :: c_int = 0x100 ;
370
665
pub const AT_SYMLINK_NOFOLLOW : :: c_int = 0x200 ;
0 commit comments