gstd_codegen

Attribute Macro async_main

Source
#[async_main]
Expand description

Mark the main async function to be the program entry point.

Can be used together with async_init.

When this macro is used, it’s not possible to specify the handle function. If you need to specify the handle function explicitly, don’t use this macro.

§Examples

Simple async handle function:

#[gstd::async_main]
async fn main() {
    gstd::debug!("Hello world!");
}

Use handle_reply and handle_signal parameters to specify corresponding handlers. Note that custom reply and signal handlers derive their default behavior.

#[gstd::async_main(handle_reply = my_handle_reply)]
async fn main() {
    // ...
}

fn my_handle_reply() {
    // ...
}