summary refs log tree commit diff
path: root/src/libstd/net
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-04-17 15:32:42 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-04-21 11:37:43 -0700
commiteeb94886adccb3f13003f92f117115d17846ce1f (patch)
tree2d729b8e48c5022941e2c06e412a2b2a1744ca1c /src/libstd/net
parente091ba3f3e8b2b00827ab4934314829b33ffb966 (diff)
downloadrust-eeb94886adccb3f13003f92f117115d17846ce1f.tar.gz
rust-eeb94886adccb3f13003f92f117115d17846ce1f.zip
std: Remove deprecated/unstable num functionality
This commit removes all the old casting/generic traits from `std::num` that are
no longer in use by the standard library. This additionally removes the old
`strconv` module which has not seen much use in quite a long time. All generic
functionality has been supplanted with traits in the `num` crate and the
`strconv` module is supplanted with the [rust-strconv crate][rust-strconv].

[rust-strconv]: https://github.com/lifthrasiir/rust-strconv

This is a breaking change due to the removal of these deprecated crates, and the
alternative crates are listed above.

[breaking-change]
Diffstat (limited to 'src/libstd/net')
-rw-r--r--src/libstd/net/mod.rs21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/libstd/net/mod.rs b/src/libstd/net/mod.rs
index a152b98822a..3bfc764e540 100644
--- a/src/libstd/net/mod.rs
+++ b/src/libstd/net/mod.rs
@@ -18,8 +18,6 @@
 use prelude::v1::*;
 
 use io::{self, Error, ErrorKind};
-#[allow(deprecated)] // Int
-use num::Int;
 use sys_common::net2 as net_imp;
 
 pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope};
@@ -55,10 +53,21 @@ pub enum Shutdown {
     Both,
 }
 
-#[allow(deprecated)] // Int
-fn hton<I: Int>(i: I) -> I { i.to_be() }
-#[allow(deprecated)] // Int
-fn ntoh<I: Int>(i: I) -> I { Int::from_be(i) }
+#[doc(hidden)]
+trait NetInt {
+    fn from_be(i: Self) -> Self;
+    fn to_be(&self) -> Self;
+}
+macro_rules! doit {
+    ($($t:ident)*) => ($(impl NetInt for $t {
+        fn from_be(i: Self) -> Self { <$t>::from_be(i) }
+        fn to_be(&self) -> Self { <$t>::to_be(*self) }
+    })*)
+}
+doit! { i8 i16 i32 i64 isize u8 u16 u32 u64 usize }
+
+fn hton<I: NetInt>(i: I) -> I { i.to_be() }
+fn ntoh<I: NetInt>(i: I) -> I { I::from_be(i) }
 
 fn each_addr<A: ToSocketAddrs, F, T>(addr: A, mut f: F) -> io::Result<T>
     where F: FnMut(&SocketAddr) -> io::Result<T>