diff options
author | Carl Lerche <me@carllerche.com> | 2015-04-01 20:35:24 -0700 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2015-04-01 20:35:24 -0700 |
commit | ffc8826dfe446b20a4c435e143cddf4b7ca34bad (patch) | |
tree | 2986506b9fa5d91334b97d3f5e06282e18b926dc /src/sys/socket | |
parent | 30ea974431848851e3ed7d4c7adfd42930d78eda (diff) | |
download | nix-ffc8826dfe446b20a4c435e143cddf4b7ca34bad.zip |
Remove usage of std::num::Int
Diffstat (limited to 'src/sys/socket')
-rw-r--r-- | src/sys/socket/addr.rs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index 85a74d93..34028246 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -4,7 +4,6 @@ use errno::Errno; use libc; use std::{fmt, hash, mem, net, ptr}; use std::ffi::{CStr, OsStr}; -use std::num::Int; use std::path::Path; use std::os::unix::ffi::OsStrExt; @@ -71,8 +70,8 @@ impl InetAddr { /// Gets the port number associated with this socket address pub fn port(&self) -> u16 { match *self { - InetAddr::V6(ref sa) => Int::from_be(sa.sin6_port), - InetAddr::V4(ref sa) => Int::from_be(sa.sin_port), + InetAddr::V6(ref sa) => u16::from_be(sa.sin6_port), + InetAddr::V4(ref sa) => u16::from_be(sa.sin_port), } } @@ -232,7 +231,7 @@ impl Ipv4Addr { } pub fn octets(&self) -> [u8; 4] { - let bits = Int::from_be(self.0.s_addr); + let bits = u32::from_be(self.0.s_addr); [(bits >> 24) as u8, (bits >> 16) as u8, (bits >> 8) as u8, bits as u8] } @@ -302,14 +301,14 @@ impl Ipv6Addr { /// Return the eight 16-bit segments that make up this address pub fn segments(&self) -> [u16; 8] { - [Int::from_be(self.0.s6_addr[0]), - Int::from_be(self.0.s6_addr[1]), - Int::from_be(self.0.s6_addr[2]), - Int::from_be(self.0.s6_addr[3]), - Int::from_be(self.0.s6_addr[4]), - Int::from_be(self.0.s6_addr[5]), - Int::from_be(self.0.s6_addr[6]), - Int::from_be(self.0.s6_addr[7])] + [u16::from_be(self.0.s6_addr[0]), + u16::from_be(self.0.s6_addr[1]), + u16::from_be(self.0.s6_addr[2]), + u16::from_be(self.0.s6_addr[3]), + u16::from_be(self.0.s6_addr[4]), + u16::from_be(self.0.s6_addr[5]), + u16::from_be(self.0.s6_addr[6]), + u16::from_be(self.0.s6_addr[7])] } pub fn to_std(&self) -> net::Ipv6Addr { |