response_middleware

Attribute Macro response_middleware 

Source
#[response_middleware]
Expand description

Registers a function as a response middleware.

This attribute macro registers the decorated function to be executed as a middleware for outgoing responses. This macro requires the #[hyperlane(server: Server)] macro to be used to define the server instance.

§Note

If an order parameter is not specified, the hook will have a higher priority than hooks with a specified order.

§Usage

use hyperlane::*;
use hyperlane_macros::*;

#[response_middleware]
struct ResponseMiddleware1;

impl ServerHook for ResponseMiddleware1 {
    async fn new(_ctx: &Context) -> Self {
        Self
    }

    async fn handle(self, ctx: &Context) {}
}

§Dependencies

This macro depends on the #[hyperlane(server: Server)] macro to define the server instance.