#[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:
#[Run_with_executor(drivers::standard_library::Executor::Executor_type::new())]
async fn my_function() {
println!("Running with custom executor!");
}
You can also use any executor expression:
#[Run_with_executor(my_custom_executor)]
async fn my_function() { ... }