Impl From<Ipv4Addr, Ipv6Addr> for IpAddr.
Fixes https://github.com/rust-lang/rfcs/issues/1816.
This commit is contained in:
parent
e60aa62ffe
commit
40053a46ff
@ -524,6 +524,18 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Ipv4Addr> for IpAddr {
|
||||
fn from(ipv4: Ipv4Addr) -> IpAddr {
|
||||
IpAddr::V4(ipv4)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Ipv6Addr> for IpAddr {
|
||||
fn from(ipv6: Ipv6Addr) -> IpAddr {
|
||||
IpAddr::V6(ipv6)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl fmt::Display for Ipv4Addr {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
Loading…
Reference in New Issue
Block a user