#[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(_: &mut Stream, _: &mut Context) -> Self {
Self
}
#[epilogue_macros(flush)]
async fn handle(self, stream: &mut Stream, ctx: &mut Context) -> Status { Status::Continue }
}
impl FlushTest {
#[flush]
async fn flush_with_ref_self(&self, stream: &mut Stream, ctx: &mut Context) -> Status { Status::Continue }
}
#[flush]
async fn standalone_flush_handler(stream: &mut Stream, ctx: &mut Context) -> Status { Status::Continue }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.