#[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: &Context) -> Self {
Self
}
#[epilogue_macros(try_flush)]
async fn handle(self, ctx: &Context) {}
}
impl TryFlushTest {
#[try_flush]
async fn try_flush_with_ref_self(&self, ctx: &Context) {}
}
#[try_flush]
async fn standalone_try_flush_handler(ctx: &Context) {}The macro takes no parameters and should be applied directly to async functions
that accept a &Context parameter.