#[main]
Available on
attributes
only.Expand description
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 (requiresrt-threaded
feature).
§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");
}