#[flush]Expand description
Flushes the response stream after function execution.
This attribute macro ensures that the response stream is flushed to guarantee immediate data transmission, forcing any buffered response data to be sent to the client.
§Usage
use hyperlane::*;
use hyperlane_macros::*;
#[route("/flush")]
struct FlushTest;
impl ServerHook for FlushTest {
async fn new(_ctx: &mut Context) -> Self {
Self
}
#[epilogue_macros(flush)]
async fn handle(self, ctx: &mut Context) {}
}
impl FlushTest {
#[flush]
async fn flush_with_ref_self(&self, ctx: &mut Context) {}
}
#[flush]
async fn standalone_flush_handler(ctx: &mut Context) {}The macro takes no parameters and should be applied directly to async functions
that accept a &mut Context parameter.
§Panics
This macro will panic if the flush operation fails.