@@ -17,7 +17,7 @@ use ::sys::socket::addr::netlink::NetlinkAddr;
17
17
*/
18
18
19
19
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
20
- #[ derive( Debug , Copy , Clone ) ]
20
+ #[ derive( Copy , Clone , PartialEq , Eq , Debug , Hash ) ]
21
21
#[ repr( C ) ]
22
22
pub struct sockaddr_nl {
23
23
pub nl_family : sa_family_t ,
@@ -560,9 +560,9 @@ impl fmt::Display for SockAddr {
560
560
pub mod netlink {
561
561
use :: sys:: socket:: addr:: { AddressFamily , sockaddr_nl} ;
562
562
use libc:: sa_family_t;
563
- use std:: { fmt, hash } ;
563
+ use std:: fmt;
564
564
565
- #[ derive( Copy ) ]
565
+ #[ derive( Copy , Clone , PartialEq , Eq , Debug , Hash ) ]
566
566
pub struct NetlinkAddr ( pub sockaddr_nl ) ;
567
567
568
568
impl NetlinkAddr {
@@ -584,27 +584,6 @@ pub mod netlink {
584
584
}
585
585
}
586
586
587
- impl PartialEq for NetlinkAddr {
588
- fn eq ( & self , other : & NetlinkAddr ) -> bool {
589
- self . 0 . nl_pid == other. 0 . nl_pid && self . 0 . nl_groups == self . 0 . nl_groups
590
- }
591
- }
592
-
593
- impl Eq for NetlinkAddr {
594
- }
595
-
596
- impl hash:: Hash for NetlinkAddr {
597
- fn hash < H : hash:: Hasher > ( & self , s : & mut H ) {
598
- ( self . 0 . nl_family , self . 0 . nl_pid , self . 0 . nl_groups ) . hash ( s)
599
- }
600
- }
601
-
602
- impl Clone for NetlinkAddr {
603
- fn clone ( & self ) -> NetlinkAddr {
604
- * self
605
- }
606
- }
607
-
608
587
impl fmt:: Display for NetlinkAddr {
609
588
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
610
589
write ! ( f, "pid: {} groups: {}" , self . pid( ) , self . groups( ) )
0 commit comments