#[closed]Expand description
Handles closed connection scenarios.
This attribute macro configures the function to handle cases where the connection has been closed, providing appropriate handling for terminated or disconnected connections.
ยงUsage
use hyperlane::*;
use hyperlane_macros::*;
#[route("/closed")]
struct ClosedTest;
impl ServerHook for ClosedTest {
async fn new(_ctx: &mut Context) -> Self {
Self
}
#[closed]
async fn handle(self, ctx: &mut Context) {}
}
impl ClosedTest {
#[closed]
async fn closed_with_ref_self(&self, ctx: &mut Context) {}
}
#[closed]
async fn standalone_closed_handler(ctx: &mut Context) {}The macro takes no parameters and should be applied directly to async functions
that accept a &mut Context parameter.