Return an instance from the ip method

This commit is contained in:
Abhishek Chanda
2016-01-31 22:05:23 -08:00
parent 5f84d3a817
commit eaa36f4b0b

View File

@ -36,8 +36,8 @@ impl Ipv4Network {
} }
} }
pub fn ip(&self) -> &Ipv4Addr { pub fn ip(&self) -> Ipv4Addr {
&(self.addr) self.addr
} }
pub fn prefix(&self) -> u8 { pub fn prefix(&self) -> u8 {
@ -68,8 +68,8 @@ impl Ipv6Network {
} }
} }
pub fn ip(&self) -> &Ipv6Addr { pub fn ip(&self) -> Ipv6Addr {
&(self.addr) self.addr
} }
pub fn prefix(&self) -> u8 { pub fn prefix(&self) -> u8 {
@ -87,8 +87,8 @@ impl IpNetwork {
pub fn ip(&self) -> IpAddr { pub fn ip(&self) -> IpAddr {
match *self { match *self {
IpNetwork::V4(ref a) => IpAddr::V4(*a.ip()), IpNetwork::V4(ref a) => IpAddr::V4(a.ip()),
IpNetwork::V6(ref a) => IpAddr::V6(*a.ip()), IpNetwork::V6(ref a) => IpAddr::V6(a.ip()),
} }
} }