Also get rid of more unnecessary method

This commit is contained in:
Abhishek Chanda
2015-05-05 12:26:16 -07:00
parent bbf8cb0964
commit 3354f6c725

View File

@ -46,17 +46,12 @@ impl Ipv4Network {
}
pub fn network_int(&self) -> u32 {
Ipv4Network::ip_to_int(*(self.ip())) & self.mask_int()
u32::from(*(self.ip())) & self.mask_int()
}
pub fn network(&self) -> Ipv4Addr {
Ipv4Addr::from(self.network_int())
}
fn ip_to_int(addr: Ipv4Addr) -> u32 {
let ip = addr.octets();
((ip[0] as u32) << 24) + ((ip[1] as u32) << 16) + ((ip[2] as u32) << 8) + (ip[3] as u32)
}
}
impl Ipv6Network {