Skip to main content

Middleware

Trait Middleware 

Source
pub trait Middleware: Send + Sync {
    // Required method
    fn handle(
        &self,
        req: Request,
        next: &(dyn Fn(Request) -> Response + Send + Sync),
    ) -> Response;
}
Expand description

Middleware contract for request/response interception around dispatch.

Required Methods§

Source

fn handle( &self, req: Request, next: &(dyn Fn(Request) -> Response + Send + Sync), ) -> Response

Handle one request and either call next or short-circuit with a response.

Implementors§