Skip to main content

run

Attribute Macro run 

#[run]
Expand description

A procedural macro to annotate functions that should run with a specific executor.

This macro wraps the annotated async function to be executed with a provided executor, handling the registration, spawning, and cleanup automatically.

§Requirements

Functions must:

  • Be async
  • Accept one &'static Manager argument
  • Have no return type (or return unit type ())

§Usage

The macro accepts an executor expression and a reference to the manager owned by the composition root:

ⓘ
#[task_macros::run(
    executor = drivers_std::executor::instantiate_static_executor!(),
    manager = &TASK_MANAGER
)]
async fn my_function(task_manager: &'static task::Manager) {
    println!("Running with custom executor!");
}