pub trait Middleware<State>: Send + Sync + 'static {
    // Required method
    fn handle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: Request<State>,
        next: Next<'life1, State>
    ) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait, Global>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn name(&self) -> &str { ... }
}
Expand description

Middleware that wraps around the remaining middleware chain.

Required Methods§

source

fn handle<'life0, 'life1, 'async_trait>( &'life0 self, request: Request<State>, next: Next<'life1, State> ) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Asynchronously handle the request, and return a response.

Provided Methods§

source

fn name(&self) -> &str

Set the middleware’s name. By default it uses the type signature.

Implementors§

source§

impl<State> Middleware<State> for LogMiddlewarewhere State: Clone + Send + Sync + 'static,

source§

impl<State> Middleware<State> for CorsMiddlewarewhere State: Clone + Send + Sync + 'static,

source§

impl<State, F> Middleware<State> for Fwhere State: Clone + Send + Sync + 'static, F: Send + Sync + 'static + for<'a> Fn(Request<State>, Next<'a, State>) -> Pin<Box<dyn Future<Output = Result<Response, Error>> + Send + 'a, Global>>,

source§

impl<State, F, Fut> Middleware<State> for After<F>where State: Clone + Send + Sync + 'static, F: Fn(Response) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Response, Error>> + Send + Sync + 'static,

source§

impl<State, F, Fut> Middleware<State> for Before<F>where State: Clone + Send + Sync + 'static, F: Fn(Request<State>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Request<State>> + Send + Sync + 'static,

source§

impl<State: Clone + Send + Sync + 'static, Key: LimitKey> Middleware<State> for TideGovernorMiddleware<Key>

source§

impl<Store, State> Middleware<State> for SessionMiddleware<Store>where Store: SessionStore, State: Clone + Send + Sync + 'static,