diff options
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/net/ip.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index 6aab7486004..36a1aed8400 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -524,6 +524,18 @@ impl fmt::Display for IpAddr { } } +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 { |
