File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change
1
+ Add ` From ` trait implementation between ` SocketAddr ` and ` Sockaddr ` , ` Sockaddr6 `
Original file line number Diff line number Diff line change @@ -919,6 +919,13 @@ impl From<SockaddrIn> for net::SocketAddrV4 {
919
919
}
920
920
}
921
921
922
+ #[ cfg( feature = "net" ) ]
923
+ impl From < SockaddrIn > for net:: SocketAddr {
924
+ fn from ( addr : SockaddrIn ) -> Self {
925
+ net:: SocketAddr :: from ( net:: SocketAddrV4 :: from ( addr) )
926
+ }
927
+ }
928
+
922
929
#[ cfg( feature = "net" ) ]
923
930
impl From < SockaddrIn > for libc:: sockaddr_in {
924
931
fn from ( sin : SockaddrIn ) -> libc:: sockaddr_in {
@@ -1075,6 +1082,13 @@ impl From<SockaddrIn6> for net::SocketAddrV6 {
1075
1082
}
1076
1083
}
1077
1084
1085
+ #[ cfg( feature = "net" ) ]
1086
+ impl From < SockaddrIn6 > for net:: SocketAddr {
1087
+ fn from ( addr : SockaddrIn6 ) -> Self {
1088
+ net:: SocketAddr :: from ( net:: SocketAddrV6 :: from ( addr) )
1089
+ }
1090
+ }
1091
+
1078
1092
#[ cfg( feature = "net" ) ]
1079
1093
impl std:: str:: FromStr for SockaddrIn6 {
1080
1094
type Err = net:: AddrParseError ;
You can’t perform that action at this time.
0 commit comments