[][src]Trait tide::Middleware

pub trait Middleware<State>: 'static + Send + Sync {
    fn handle<'a>(
        &'a self,
        request: Request<State>,
        next: Next<'a, State>
    ) -> Pin<Box<dyn Future<Output = Result> + Send + 'a>>; fn name(&self) -> &str { ... } }

Middleware that wraps around the remaining middleware chain.

Required methods

fn handle<'a>(
    &'a self,
    request: Request<State>,
    next: Next<'a, State>
) -> Pin<Box<dyn Future<Output = Result> + Send + 'a>>

Asynchronously handle the request, and return a response.

Loading content...

Provided methods

fn name(&self) -> &str

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

Loading content...

Implementors

impl<State, F> Middleware<State> for F where
    F: Send + Sync + 'static + for<'a> Fn(Request<State>, Next<'a, State>) -> Pin<Box<dyn Future<Output = Result> + Send + 'a>>, 
[src]

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

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

impl<State: Send + Sync + 'static> Middleware<State> for LogMiddleware[src]

impl<State: Send + Sync + 'static> Middleware<State> for CorsMiddleware[src]

Loading content...