Added to pulsync-derive as a #[proc_macro_attribute]. It rewrites a plain async fn run into the dyn-compatible Pin<Box> form:
// User writes:
#[async_handler]
impl AsyncTaskHandler for MyTask {
async fn run(&self) {
do_work().await;
}
}
// Macro emits:
impl AsyncTaskHandler for MyTask {
fn run(&self) -> Pin<Box<dyn Future<Output = ()> + Send + '_ + Sync>> {
Box::pin(async move { do_work().await; })
}
}
This reduce the complex type return for the user.
Added to pulsync-derive as a #[proc_macro_attribute]. It rewrites a plain async fn run into the dyn-compatible Pin<Box> form:
This reduce the complex type return for the user.