diff options
Diffstat (limited to 'src/libstd/net/mod.rs')
| -rw-r--r-- | src/libstd/net/mod.rs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/libstd/net/mod.rs b/src/libstd/net/mod.rs index b8cb8cb5289..36f36af73e1 100644 --- a/src/libstd/net/mod.rs +++ b/src/libstd/net/mod.rs @@ -11,10 +11,9 @@ //! Networking primitives for TCP/UDP communication //! //! > **NOTE**: This module is very much a work in progress and is under active -//! > development. At this time it is still recommended to use the `old_io` -//! > module while the details of this module shake out. +//! > development. -#![unstable(feature = "net")] +#![stable(feature = "rust1", since = "1.0.0")] use prelude::v1::*; @@ -22,8 +21,8 @@ use io::{self, Error, ErrorKind}; use num::Int; use sys_common::net2 as net_imp; -pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope}; -pub use self::addr::{SocketAddr, ToSocketAddrs}; +pub use self::ip::{Ipv4Addr, Ipv6Addr, Ipv6MulticastScope}; +pub use self::addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs}; pub use self::tcp::{TcpStream, TcpListener}; pub use self::udp::UdpSocket; @@ -37,23 +36,27 @@ mod parser; /// Possible values which can be passed to the `shutdown` method of `TcpStream` /// and `UdpSocket`. #[derive(Copy, Clone, PartialEq)] +#[stable(feature = "rust1", since = "1.0.0")] pub enum Shutdown { /// Indicates that the reading portion of this stream/socket should be shut /// down. All currently blocked and future reads will return `Ok(0)`. + #[stable(feature = "rust1", since = "1.0.0")] Read, /// Indicates that the writing portion of this stream/socket should be shut /// down. All currently blocked and future writes will return an error. + #[stable(feature = "rust1", since = "1.0.0")] Write, /// Shut down both the reading and writing portions of this stream. /// /// See `Shutdown::Read` and `Shutdown::Write` for more information. - Both + #[stable(feature = "rust1", since = "1.0.0")] + Both, } fn hton<I: Int>(i: I) -> I { i.to_be() } fn ntoh<I: Int>(i: I) -> I { Int::from_be(i) } -fn each_addr<A: ToSocketAddrs + ?Sized, F, T>(addr: &A, mut f: F) -> io::Result<T> +fn each_addr<A: ToSocketAddrs, F, T>(addr: A, mut f: F) -> io::Result<T> where F: FnMut(&SocketAddr) -> io::Result<T> { let mut last_err = None; @@ -70,8 +73,10 @@ fn each_addr<A: ToSocketAddrs + ?Sized, F, T>(addr: &A, mut f: F) -> io::Result< } /// An iterator over `SocketAddr` values returned from a host lookup operation. +#[stable(feature = "rust1", since = "1.0.0")] pub struct LookupHost(net_imp::LookupHost); +#[stable(feature = "rust1", since = "1.0.0")] impl Iterator for LookupHost { type Item = io::Result<SocketAddr>; fn next(&mut self) -> Option<io::Result<SocketAddr>> { self.0.next() } @@ -94,6 +99,7 @@ impl Iterator for LookupHost { /// # Ok(()) /// # } /// ``` +#[stable(feature = "rust1", since = "1.0.0")] pub fn lookup_host(host: &str) -> io::Result<LookupHost> { net_imp::lookup_host(host).map(LookupHost) } |
