macros: #[tokio::main] can be used on non-main (#3199)

This commit is contained in:
Ivan Tham
2020-11-30 17:34:11 +01:00
committed by GitHub
parent a85fdb884d
commit 72d6346c0d
+6
View File
@@ -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