#[try_flush]Expand description
Tries to flush the response stream after function execution.
This attribute macro ensures that the response stream is tried to be flushed to guarantee immediate data transmission, forcing any buffered response data to be sent to the client. This will not panic on failure.
ยงUsage
use hyperlane::*;
use hyperlane_macros::*;
#[route("/try_flush")]
struct TryFlushTest;
impl ServerHook for TryFlushTest {
async fn new(_ctx: &mut Context) -> Self {
Self
}
#[epilogue_macros(try_flush)]
async fn handle(self, ctx: &mut Context) {}
}
impl TryFlushTest {
#[try_flush]
async fn try_flush_with_ref_self(&self, ctx: &mut Context) {}
}
#[try_flush]
async fn standalone_try_flush_handler(ctx: &mut Context) {}The macro takes no parameters and should be applied directly to async functions
that accept a &mut Context parameter.