Attribute Macro worker::send

source ·
#[send]
Expand description

Convert an async function which is !Send to be Send.

This is useful for implementing async handlers in frameworks which expect the handler to be Send, such as axum.

#[worker::send]
async fn foo() {
    // JsFuture is !Send
    let fut = JsFuture::from(promise);
    fut.await
}