Trait crux_http::middleware::Middleware

source ·
pub trait Middleware:
    'static
    + Send
    + Sync {
    // Required method
    fn handle<'life0, 'life1, 'async_trait>(
        &'life0 self,
        req: Request,
        client: Client,
        next: Next<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<ResponseAsync>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Middleware that wraps around remaining middleware chain.

Required Methods§

source

fn handle<'life0, 'life1, 'async_trait>( &'life0 self, req: Request, client: Client, next: Next<'life1>, ) -> Pin<Box<dyn Future<Output = Result<ResponseAsync>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Asynchronously handle the request, and return a response.

Implementors§

source§

impl Middleware for Redirect

source§

impl<F> Middleware for F
where F: Send + Sync + 'static + for<'a> Fn(Request, Client, Next<'a>) -> BoxFuture<'a, Result<ResponseAsync>>,