summaryrefslogtreecommitdiffstats
path: root/tokio/src/time/clock.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/time/clock.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/time/clock.rs')
-rw-r--r--tokio/src/time/clock.rs13
1 files changed, 2 insertions, 11 deletions
diff --git a/tokio/src/time/clock.rs b/tokio/src/time/clock.rs
index 7727f404..e44f4925 100644
--- a/tokio/src/time/clock.rs
+++ b/tokio/src/time/clock.rs
@@ -4,15 +4,7 @@
//! `test-util` feature flag is enabled, the values returned for `now()` are
//! configurable.
-#[cfg(feature = "test-util")]
-pub(crate) use self::variant::now;
-pub(crate) use self::variant::Clock;
-#[cfg(feature = "test-util")]
-#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
-pub use self::variant::{advance, pause, resume};
-
-#[cfg(not(feature = "test-util"))]
-mod variant {
+cfg_not_test_util! {
use crate::time::Instant;
#[derive(Debug, Clone)]
@@ -40,8 +32,7 @@ mod variant {
}
}
-#[cfg(feature = "test-util")]
-mod variant {
+cfg_test_util! {
use crate::time::{Duration, Instant};
use std::cell::Cell;