flush

Attribute Macro flush 

Source
#[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: &Context) -> Self {
        Self
    }

    #[epilogue_macros(flush)]
    async fn handle(self, ctx: &Context) {}
}

impl FlushTest {
    #[flush]
    async fn flush_with_ref_self(&self, ctx: &Context) {}
}

#[flush]
async fn standalone_flush_handler(ctx: &Context) {}

The macro takes no parameters and should be applied directly to async functions that accept a &Context parameter.