diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 35 |
1 files changed, 34 insertions, 1 deletions
@@ -1,4 +1,4 @@ -#![doc(html_root_url = "https://docs.rs/tokio-macros/1.0.0")] +#![doc(html_root_url = "https://docs.rs/tokio-macros/1.1.0")] #![allow(clippy::needless_doctest_main)] #![warn( missing_debug_implementations, @@ -144,6 +144,30 @@ use proc_macro::TokenStream; /// } /// ``` /// +/// ### Configure the runtime to start with time paused +/// +/// ```rust +/// #[tokio::main(flavor = "current_thread", start_paused = true)] +/// async fn main() { +/// println!("Hello world"); +/// } +/// ``` +/// +/// Equivalent code not using `#[tokio::main]` +/// +/// ```rust +/// fn main() { +/// tokio::runtime::Builder::new_current_thread() +/// .enable_all() +/// .start_paused(true) +/// .build() +/// .unwrap() +/// .block_on(async { +/// println!("Hello world"); +/// }) +/// } +/// ``` +/// /// ### NOTE: /// /// If you rename the Tokio crate in your dependencies this macro will not work. @@ -225,6 +249,15 @@ pub fn main_rt(args: TokenStream, item: TokenStream) -> TokenStream { /// } /// ``` /// +/// ### Configure the runtime to start with time paused +/// +/// ```no_run +/// #[tokio::test(start_paused = true)] +/// async fn my_test() { +/// assert!(true); +/// } +/// ``` +/// /// ### NOTE: /// /// If you rename the Tokio crate in your dependencies this macro will not work. |