send_once

Attribute Macro send_once 

Source
#[send_once]
Expand description

Sends the complete response exactly once after function execution.

This attribute macro ensures that the response is sent exactly once to the client, preventing multiple response transmissions for single-use scenarios.

ยงUsage

use hyperlane::*;
use hyperlane_macros::*;

#[send_once]
async fn send_once_handler(ctx: Context) {
    let _ = ctx.set_response_body("One-time response").await;
    // Response is sent exactly once after function returns
}

The macro takes no parameters and should be applied directly to async functions that accept a Context parameter.