summaryrefslogtreecommitdiffstats
path: root/tokio/src/lib.rs
diff options
context:
space:
mode:
authorSean McArthur <sean@seanmonstar.com>2019-09-24 11:39:36 -0700
committerSean McArthur <sean@seanmonstar.com>2019-09-24 12:17:04 -0700
commit18cef1901fc805e7ef3443538c0931836891eab7 (patch)
treedb68dc07a5917735a8361ae0a2a2b5d69bbfb6c6 /tokio/src/lib.rs
parentc81447fdccc31081b6af03015853dd8d05fd32f1 (diff)
tokio: add `rt-current-thread` optional feature
- Adds a minimum `rt-current-thread` optional feature that exports `tokio::runtime::current_thread`. - Adds a `macros` optional feature to enable the `#[tokio::main]` and `#[tokio::test]` attributes. - Adjusts `#[tokio::main]` macro to select a runtime "automatically" if a specific strategy isn't specified. Allows using the macro with only the rt-current-thread feature.
Diffstat (limited to 'tokio/src/lib.rs')
-rw-r--r--tokio/src/lib.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs
index 30375c0a..14a7a3ab 100644
--- a/tokio/src/lib.rs
+++ b/tokio/src/lib.rs
@@ -72,7 +72,10 @@
macro_rules! if_runtime {
($($i:item)*) => ($(
- #[cfg(any(feature = "rt-full"))]
+ #[cfg(any(
+ feature = "rt-full",
+ feature = "rt-current-thread",
+ ))]
$i
)*)
}
@@ -103,8 +106,10 @@ if_runtime! {
pub use crate::executor::spawn;
#[cfg(not(test))] // Work around for rust-lang/rust#62127
+ #[cfg(feature = "macros")]
#[doc(inline)]
pub use tokio_macros::main;
+ #[cfg(feature = "macros")]
#[doc(inline)]
pub use tokio_macros::test;
}