diff options
author | Haibo Huang <hhb@google.com> | 2020-12-22 18:17:29 -0800 |
---|---|---|
committer | Haibo Huang <hhb@google.com> | 2020-12-22 18:17:29 -0800 |
commit | b98e0debbb3acf2325a27de4dc45b379d29fc2c9 (patch) | |
tree | 65c53b7e11d3e3d89f2835515ad962de1716c0ed /src/lib.rs | |
parent | 72a5f2488c88590491608f52528c528cea514722 (diff) | |
download | tokio-macros-b98e0debbb3acf2325a27de4dc45b379d29fc2c9.tar.gz |
Upgrade rust/crates/tokio-macros to 0.3.2
Test: make
Change-Id: Ib3f1d6c666a79df996e30fea255d62372a8b49a8
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 26 |
1 files changed, 16 insertions, 10 deletions
@@ -1,4 +1,4 @@ -#![doc(html_root_url = "https://docs.rs/tokio-macros/0.3.1")] +#![doc(html_root_url = "https://docs.rs/tokio-macros/0.3.2")] #![allow(clippy::needless_doctest_main)] #![warn( missing_debug_implementations, @@ -35,6 +35,12 @@ use proc_macro::TokenStream; /// [Builder](../tokio/runtime/struct.Builder.html), which provides a more /// powerful interface. /// +/// Note: This macro can be used on any function and not just the `main` +/// function. Using it on a non-main function makes the function behave +/// as if it was synchronous by starting a new runtime each time it is called. +/// If the function is called often, it is preferable to create the runtime using +/// the runtime builder so the runtime can be reused across calls. +/// /// # Multi-threaded runtime /// /// To use the multi-threaded runtime, the macro can be configured using @@ -138,8 +144,8 @@ use proc_macro::TokenStream; /// ### NOTE: /// /// If you rename the tokio crate in your dependencies this macro will not work. -/// If you must rename the 0.2 version of tokio because you're also using the -/// 0.1 version of tokio, you _must_ make the tokio 0.2 crate available as +/// If you must rename the 0.3 version of tokio because you're also using the +/// 0.1 version of tokio, you _must_ make the tokio 0.3 crate available as /// `tokio` in the module where this macro is expanded. #[proc_macro_attribute] #[cfg(not(test))] // Work around for rust-lang/rust#62127 @@ -183,9 +189,9 @@ pub fn main(args: TokenStream, item: TokenStream) -> TokenStream { /// ### NOTE: /// /// If you rename the tokio crate in your dependencies this macro -/// will not work. If you must rename the 0.2 version of tokio because +/// will not work. If you must rename the 0.3 version of tokio because /// you're also using the 0.1 version of tokio, you _must_ make the -/// tokio 0.2 crate available as `tokio` in the module where this +/// tokio 0.3 crate available as `tokio` in the module where this /// macro is expanded. #[proc_macro_attribute] #[cfg(not(test))] // Work around for rust-lang/rust#62127 @@ -208,7 +214,7 @@ pub fn main_rt(args: TokenStream, item: TokenStream) -> TokenStream { /// /// ### Using default /// -/// The default test runtime is multi-threaded. +/// The default test runtime is single-threaded. /// /// ```no_run /// #[tokio::test] @@ -220,9 +226,9 @@ pub fn main_rt(args: TokenStream, item: TokenStream) -> TokenStream { /// ### NOTE: /// /// If you rename the tokio crate in your dependencies this macro -/// will not work. If you must rename the 0.2 version of tokio because +/// will not work. If you must rename the 0.3 version of tokio because /// you're also using the 0.1 version of tokio, you _must_ make the -/// tokio 0.2 crate available as `tokio` in the module where this +/// tokio 0.3 crate available as `tokio` in the module where this /// macro is expanded. #[proc_macro_attribute] pub fn test(args: TokenStream, item: TokenStream) -> TokenStream { @@ -243,9 +249,9 @@ pub fn test(args: TokenStream, item: TokenStream) -> TokenStream { /// ### NOTE: /// /// If you rename the tokio crate in your dependencies this macro -/// will not work. If you must rename the 0.2 version of tokio because +/// will not work. If you must rename the 0.3 version of tokio because /// you're also using the 0.1 version of tokio, you _must_ make the -/// tokio 0.2 crate available as `tokio` in the module where this +/// tokio 0.3 crate available as `tokio` in the module where this /// macro is expanded. #[proc_macro_attribute] pub fn test_rt(args: TokenStream, item: TokenStream) -> TokenStream { |