chore: prepare tokio-macros 1.4.1 (#4142)

This reverts commit 33f0a1fd2e.
This commit is contained in:
Alice Ryhl
2021-09-30 10:38:52 +02:00
committed by GitHub
parent 44cfe10ee5
commit d39c9ed9dc
8 changed files with 69 additions and 58 deletions
+5 -4
View File
@@ -339,10 +339,11 @@ fn parse_knobs(
{
let body = async #body;
#[allow(clippy::expect_used)]
#tail_return tokio::task::LocalSet::new().block_on(
&#rt.enable_all().build().expect("Failed building the Runtime"),
body,
)#tail_semicolon
#tail_return #rt
.enable_all()
.build()
.expect("Failed building the Runtime")
.block_on(body)#tail_semicolon
}
})
.expect("Parsing failure");
+25 -33
View File
@@ -27,9 +27,6 @@ use proc_macro::TokenStream;
/// helps set up a `Runtime` without requiring the user to use
/// [Runtime](../tokio/runtime/struct.Runtime.html) or
/// [Builder](../tokio/runtime/struct.Builder.html) directly.
/// The function executes in the context of a
/// [LocalSet](../tokio/task/struct.LocalSet.html), allowing calls to
/// [spawn_local](../tokio/task/fn.spawn_local.html) without further setup.
///
/// Note: This macro is designed to be simplistic and targets applications that
/// do not require a complex setup. If the provided functionality is not
@@ -87,14 +84,13 @@ use proc_macro::TokenStream;
///
/// ```rust
/// fn main() {
/// let ls = tokio::task::LocalSet::new();
/// let rt = tokio::runtime::Builder::new_multi_thread()
/// tokio::runtime::Builder::new_multi_thread()
/// .enable_all()
/// .build()
/// .unwrap();
/// ls.block_on(&rt, async {
/// println!("Hello world");
/// })
/// .unwrap()
/// .block_on(async {
/// println!("Hello world");
/// })
/// }
/// ```
///
@@ -113,14 +109,13 @@ use proc_macro::TokenStream;
///
/// ```rust
/// fn main() {
/// let ls = tokio::task::LocalSet::new();
/// let rt = tokio::runtime::Builder::new_current_thread()
/// tokio::runtime::Builder::new_current_thread()
/// .enable_all()
/// .build()
/// .unwrap();
/// ls.block_on(&rt, async {
/// println!("Hello world");
/// })
/// .unwrap()
/// .block_on(async {
/// println!("Hello world");
/// })
/// }
/// ```
///
@@ -137,15 +132,14 @@ use proc_macro::TokenStream;
///
/// ```rust
/// fn main() {
/// let ls = tokio::task::LocalSet::new();
/// let rt = tokio::runtime::Builder::new_multi_thread()
/// tokio::runtime::Builder::new_multi_thread()
/// .worker_threads(2)
/// .enable_all()
/// .build()
/// .unwrap();
/// ls.block_on(&rt, async {
/// println!("Hello world");
/// })
/// .unwrap()
/// .block_on(async {
/// println!("Hello world");
/// })
/// }
/// ```
///
@@ -162,15 +156,14 @@ use proc_macro::TokenStream;
///
/// ```rust
/// fn main() {
/// let ls = tokio::task::LocalSet::new();
/// let rt = tokio::runtime::Builder::new_current_thread()
/// tokio::runtime::Builder::new_current_thread()
/// .enable_all()
/// .start_paused(true)
/// .build()
/// .unwrap();
/// ls.block_on(&rt, async {
/// println!("Hello world");
/// })
/// .unwrap()
/// .block_on(async {
/// println!("Hello world");
/// })
/// }
/// ```
///
@@ -211,14 +204,13 @@ pub fn main(args: TokenStream, item: TokenStream) -> TokenStream {
///
/// ```rust
/// fn main() {
/// let ls = tokio::task::LocalSet::new();
/// let rt = tokio::runtime::Builder::new_current_thread()
/// tokio::runtime::Builder::new_current_thread()
/// .enable_all()
/// .build()
/// .unwrap();
/// ls.block_on(&rt, async {
/// println!("Hello world");
/// })
/// .unwrap()
/// .block_on(async {
/// println!("Hello world");
/// })
/// }
/// ```
///