[][src]Attribute Macro tokio::main

#[main]

Marks async function to be executed by selected runtime.

Options:

  • single_thread - Uses current_thread.
  • multi_thread - Uses multi-threaded runtime. Used by default.

Usage

Select runtime

#[tokio::main(single_thread)]
async fn main() {
    println!("Hello world");
}

Using default

#[tokio::main]
async fn main() {
    println!("Hello world");
}