#[send_once_with_data]Expand description
Sends the complete response exactly once with data 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, with the specified data.
ยงUsage
use hyperlane::*;
use hyperlane_macros::*;
#[route("/send_once_with_data")]
struct SendOnceWithData;
impl ServerHook for SendOnceWithData {
async fn new(_ctx: &Context) -> Self {
Self
}
#[epilogue_macros(send_once_with_data("One-time response"))]
async fn handle(self, ctx: &Context) {}
}The macro accepts data to send and should be applied to async functions
that accept a &Context parameter.