summaryrefslogtreecommitdiff
path: root/src/sys/socket/addr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sys/socket/addr.rs')
-rw-r--r--src/sys/socket/addr.rs23
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 {