Attribute Macro madsim::main[][src]

#[main]
Expand description

Marks async function to be executed by the selected runtime. This macro helps set up a Runtime without requiring the user to use Runtime directly.

Example

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

Equivalent code not using #[madsim::main]

fn main() {
    madsim::Runtime::new().block_on(async {
        println!("Hello world");
    });
}