Merge #549
549: wire: add From<Address> for ::std::net::IpAddr r=Dirbaio a=Dirbaio Originally from #296 Co-authored-by: Marc-André Lureau <marcandre.lureau@redhat.com>master
commit
03492be337
|
@ -214,6 +214,19 @@ impl From<::std::net::IpAddr> for Address {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl From<Address> for ::std::net::IpAddr {
|
||||
fn from(x: Address) -> ::std::net::IpAddr {
|
||||
match x {
|
||||
#[cfg(feature = "proto-ipv4")]
|
||||
Address::Ipv4(ipv4) => ::std::net::IpAddr::V4(ipv4.into()),
|
||||
#[cfg(feature = "proto-ipv6")]
|
||||
Address::Ipv6(ipv6) => ::std::net::IpAddr::V6(ipv6.into()),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "std", feature = "proto-ipv4"))]
|
||||
impl From<::std::net::Ipv4Addr> for Address {
|
||||
fn from(ipv4: ::std::net::Ipv4Addr) -> Address {
|
||||
|
|
Loading…
Reference in New Issue