Middleware

Trait Middleware 

Source
pub trait Middleware: Send + Sync {
    // Required method
    fn handle<'t, 'n, 'a>(
        &'t self,
        req: Request,
        next: &'n dyn Handler,
    ) -> BoxFuture<'a, Result<Response>>
       where Self: 'a,
             't: 'a,
             'n: 'a;

    // Provided method
    fn boxed(self) -> Box<dyn Middleware>
       where Self: Sized + 'static { ... }
}

Required Methods§

Source

fn handle<'t, 'n, 'a>( &'t self, req: Request, next: &'n dyn Handler, ) -> BoxFuture<'a, Result<Response>>
where Self: 'a, 't: 'a, 'n: 'a,

Provided Methods§

Source

fn boxed(self) -> Box<dyn Middleware>
where Self: Sized + 'static,

Trait Implementations§

Source§

impl Middleware for Box<dyn Middleware>

Source§

fn handle<'t, 'n, 'a>( &'t self, req: Request, next: &'n dyn Handler, ) -> BoxFuture<'a, Result<Response>>
where Self: 'a, 't: 'a, 'n: 'a,

Source§

fn boxed(self) -> Box<dyn Middleware>
where Self: Sized + 'static,

Implementations on Foreign Types§

Source§

impl Middleware for Box<dyn Middleware>

Source§

fn handle<'t, 'n, 'a>( &'t self, req: Request, next: &'n dyn Handler, ) -> BoxFuture<'a, Result<Response>>
where Self: 'a, 't: 'a, 'n: 'a,

Implementors§

Source§

impl<F> Middleware for MiddlewareFn<F>
where F: for<'a> AsyncFn<'a, (Request, &'a dyn Handler), Output = Result<Response>>,

Source§

impl<S, F> Middleware for ArcMiddlewareFn<S, F>
where S: Send + Sync + 'static, F: for<'a> AsyncFn<'a, (Arc<S>, Request, &'a dyn Handler), Output = Result<Response>>,

Source§

impl<S, F> Middleware for RefMiddlewareFn<S, F>
where S: Send + Sync + 'static, F: for<'a> AsyncFn<'a, (&'a S, Request, &'a dyn Handler), Output = Result<Response>>,