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
  • Have no arguments
  • Have no return type (or return unit type ())

§Usage

The macro accepts an executor expression as a parameter:

#[task_macros::run(drivers_std::executor::instantiate_static_executor!())]
async fn my_function() {
    println!("Running with custom executor!");
}