summaryrefslogtreecommitdiffstats
path: root/tokio/src/net/mod.rs
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2019-11-18 07:00:55 -0800
committerGitHub <noreply@github.com>2019-11-18 07:00:55 -0800
commit0d38936b35779b604770120da2e98560bbb6241f (patch)
tree843d46e999becdb580cb02655b4290acadd64474 /tokio/src/net/mod.rs
parent13b6e9939e062dc01bcf34abe3d75de4b66e20e1 (diff)
chore: refine feature flags (#1785)
Removes dependencies between Tokio feature flags. For example, `process` should not depend on `sync` simply because it uses the `mpsc` channel. Instead, feature flags represent **public** APIs that become available with the feature enabled. When the feature is not enabled, the functionality is removed. If another Tokio component requires the functionality, it is stays as `pub(crate)`. The threaded scheduler is now exposed under `rt-threaded`. This feature flag only enables the threaded scheduler and does not include I/O, networking, or time. Those features must be explictly enabled. A `full` feature flag is added that enables all features. `stdin`, `stdout`, `stderr` are exposed under `io-std`. Macros are used to scope code by feature flag.
Diffstat (limited to 'tokio/src/net/mod.rs')
-rw-r--r--tokio/src/net/mod.rs40
1 files changed, 19 insertions, 21 deletions
diff --git a/tokio/src/net/mod.rs b/tokio/src/net/mod.rs
index 2ebf773f..50021e37 100644
--- a/tokio/src/net/mod.rs
+++ b/tokio/src/net/mod.rs
@@ -24,24 +24,22 @@
mod addr;
pub use addr::ToSocketAddrs;
-pub mod driver;
-
-pub mod util;
-
-#[cfg(feature = "tcp")]
-pub mod tcp;
-
-#[cfg(feature = "tcp")]
-pub use self::tcp::{TcpListener, TcpStream};
-
-#[cfg(feature = "udp")]
-pub mod udp;
-
-#[cfg(feature = "udp")]
-pub use self::udp::UdpSocket;
-
-#[cfg(all(unix, feature = "uds"))]
-pub mod unix;
-
-#[cfg(all(unix, feature = "uds"))]
-pub use self::unix::{UnixDatagram, UnixListener, UnixStream};
+cfg_io_driver! {
+ pub mod driver;
+ pub mod util;
+}
+
+cfg_tcp! {
+ pub mod tcp;
+ pub use tcp::{TcpListener, TcpStream};
+}
+
+cfg_udp! {
+ pub mod udp;
+ pub use udp::UdpSocket;
+}
+
+cfg_uds! {
+ pub mod unix;
+ pub use unix::{UnixDatagram, UnixListener, UnixStream};
+}