[−][src]Attribute Macro tokio::main
#[main]
This is supported on
feature="macros"
only.Marks async function to be executed by selected runtime.
Options:
basic_scheduler
- All tasks are executed on the current thread.threaded_scheduler
- Uses the multi-threaded scheduler. Used by default.
Function arguments:
Arguments are allowed for any functions aside from main
which is special
Usage
Using default
#[tokio::main] async fn main() { println!("Hello world"); }
Select runtime
#[tokio::main(basic_scheduler)] async fn main() { println!("Hello world"); }