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