Skip to main content

main

Attribute Macro main 

Source
#[main]
Expand description

Runs an async function as a synchronous entry point.

The async-rt crate selects the default executor when it re-exports this macro. A built-in executor can be selected explicitly with, for example, #[async_rt::main(executor = "compio")].

An explicit selection controls the runtime driving this function and the executor used by async_rt::task.

A custom driver can be supplied with driver = expression. It drives the annotated future without changing the executor used by async_rt::task.