From 891de3271dc3545fb09162e578251e9977d9789c Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Tue, 13 Oct 2020 03:36:26 +0900 Subject: net: merge tcp, udp, uds features to net feature (#2943) --- tokio/src/net/addr.rs | 2 +- tokio/src/net/mod.rs | 8 +++----- tokio/src/net/tcp/listener.rs | 2 +- tokio/src/net/tcp/stream.rs | 2 +- tokio/src/net/udp/socket.rs | 2 +- tokio/src/net/unix/datagram/socket.rs | 2 +- tokio/src/net/unix/listener.rs | 4 ++-- tokio/src/net/unix/stream.rs | 2 +- 8 files changed, 11 insertions(+), 13 deletions(-) (limited to 'tokio/src/net') diff --git a/tokio/src/net/addr.rs b/tokio/src/net/addr.rs index e2d09d47..86ae9919 100644 --- a/tokio/src/net/addr.rs +++ b/tokio/src/net/addr.rs @@ -23,7 +23,7 @@ pub trait ToSocketAddrs: sealed::ToSocketAddrsPriv {} type ReadyFuture = future::Ready>; -#[cfg(any(feature = "dns", feature = "tcp", feature = "udp"))] +#[cfg(any(feature = "dns", feature = "net"))] pub(crate) fn to_socket_addrs(arg: T) -> T::Future where T: ToSocketAddrs, diff --git a/tokio/src/net/mod.rs b/tokio/src/net/mod.rs index a91085f8..f355356f 100644 --- a/tokio/src/net/mod.rs +++ b/tokio/src/net/mod.rs @@ -23,7 +23,7 @@ //! [`UnixDatagram`]: UnixDatagram mod addr; -#[cfg(any(feature = "tcp", feature = "udp"))] +#[cfg(feature = "net")] pub(crate) use addr::to_socket_addrs; pub use addr::ToSocketAddrs; @@ -32,19 +32,17 @@ cfg_dns! { pub use lookup_host::lookup_host; } -cfg_tcp! { +cfg_net! { pub mod tcp; pub use tcp::listener::TcpListener; pub use tcp::socket::TcpSocket; pub use tcp::stream::TcpStream; -} -cfg_udp! { pub mod udp; pub use udp::socket::UdpSocket; } -cfg_uds! { +cfg_net_unix! { pub mod unix; pub use unix::datagram::socket::UnixDatagram; pub use unix::listener::UnixListener; diff --git a/tokio/src/net/tcp/listener.rs b/tokio/src/net/tcp/listener.rs index 98c8961e..57500615 100644 --- a/tokio/src/net/tcp/listener.rs +++ b/tokio/src/net/tcp/listener.rs @@ -8,7 +8,7 @@ use std::io; use std::net::{self, SocketAddr}; use std::task::{Context, Poll}; -cfg_tcp! { +cfg_net! { /// A TCP socket server, listening for connections. /// /// You can accept a new connection by using the [`accept`](`TcpListener::accept`) method. Alternatively `TcpListener` diff --git a/tokio/src/net/tcp/stream.rs b/tokio/src/net/tcp/stream.rs index 0a58e481..7acab7db 100644 --- a/tokio/src/net/tcp/stream.rs +++ b/tokio/src/net/tcp/stream.rs @@ -11,7 +11,7 @@ use std::net::{Shutdown, SocketAddr}; use std::pin::Pin; use std::task::{Context, Poll}; -cfg_tcp! { +cfg_net! { /// A TCP stream between a local and a remote socket. /// /// A TCP stream can either be created by connecting to an endpoint, via the diff --git a/tokio/src/net/udp/socket.rs b/tokio/src/net/udp/socket.rs index 18ae2402..77e5dd43 100644 --- a/tokio/src/net/udp/socket.rs +++ b/tokio/src/net/udp/socket.rs @@ -6,7 +6,7 @@ use std::fmt; use std::io; use std::net::{self, Ipv4Addr, Ipv6Addr, SocketAddr}; -cfg_udp! { +cfg_net! { /// A UDP socket /// /// UDP is "connectionless", unlike TCP. Meaning, regardless of what address you've bound to, a `UdpSocket` diff --git a/tokio/src/net/unix/datagram/socket.rs b/tokio/src/net/unix/datagram/socket.rs index 5dcda6c9..3ae66d1f 100644 --- a/tokio/src/net/unix/datagram/socket.rs +++ b/tokio/src/net/unix/datagram/socket.rs @@ -9,7 +9,7 @@ use std::os::unix::io::{AsRawFd, RawFd}; use std::os::unix::net; use std::path::Path; -cfg_uds! { +cfg_net_unix! { /// An I/O object representing a Unix datagram socket. /// /// A socket can be either named (associated with a filesystem path) or diff --git a/tokio/src/net/unix/listener.rs b/tokio/src/net/unix/listener.rs index fb85da9f..b2726456 100644 --- a/tokio/src/net/unix/listener.rs +++ b/tokio/src/net/unix/listener.rs @@ -9,7 +9,7 @@ use std::os::unix::net; use std::path::Path; use std::task::{Context, Poll}; -cfg_uds! { +cfg_net_unix! { /// A Unix socket which can accept connections from other Unix sockets. /// /// You can accept a new connection by using the [`accept`](`UnixListener::accept`) method. Alternatively `UnixListener` @@ -112,7 +112,7 @@ impl UnixListener { /// Polls to accept a new incoming connection to this listener. /// /// If there is no connection to accept, `Poll::Pending` is returned and - /// the current task will be notified by a waker. + /// the current task will be notified by a waker. /// /// When ready, the most recent task that called `poll_accept` is notified. /// The caller is responsble to ensure that `poll_accept` is called from a diff --git a/tokio/src/net/unix/stream.rs b/tokio/src/net/unix/stream.rs index c539f224..5138077b 100644 --- a/tokio/src/net/unix/stream.rs +++ b/tokio/src/net/unix/stream.rs @@ -15,7 +15,7 @@ use std::path::Path; use std::pin::Pin; use std::task::{Context, Poll}; -cfg_uds! { +cfg_net_unix! { /// A structure representing a connected Unix socket. /// /// This socket can be connected directly with `UnixStream::connect` or accepted -- cgit v1.2.3