Skip to main content

Middleware

Trait Middleware 

Source
pub trait Middleware:
    Send
    + Sync
    + 'static {
    // Required method
    fn handle<'a>(
        &'a self,
        ctx: &'a mut RequestCtx,
        next: Next<'a>,
    ) -> MiddlewareFuture<'a>;
}
Expand description

Wraps request handling. Call next.run(&mut *ctx).await to continue; return early to short-circuit (auth rejections, rate limits, …).

Required Methods§

Source

fn handle<'a>( &'a self, ctx: &'a mut RequestCtx, next: Next<'a>, ) -> MiddlewareFuture<'a>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§