Make ip_to_int a static method

This commit is contained in:
Abhishek Chanda
2015-04-24 00:10:08 -07:00
parent 450d98348a
commit eed25247b5

View File

@ -43,7 +43,7 @@ impl Ipv4Network {
Ipv4Network::int_to_ip(mask).to_string()
}
fn ip_to_int(&self, addr: Ipv4Addr) -> u32 {
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)
}