diff options
author | Sean McArthur <sean@seanmonstar.com> | 2019-09-24 11:39:36 -0700 |
---|---|---|
committer | Sean McArthur <sean@seanmonstar.com> | 2019-09-24 12:17:04 -0700 |
commit | 18cef1901fc805e7ef3443538c0931836891eab7 (patch) | |
tree | db68dc07a5917735a8361ae0a2a2b5d69bbfb6c6 /tokio/src/lib.rs | |
parent | c81447fdccc31081b6af03015853dd8d05fd32f1 (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.rs | 7 |
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; } |