[][src]Trait vicuna::handler::WrappingHandler

pub trait WrappingHandler<E> {
    fn wrap_with<M: Fn(Handler<E>) -> Handler<E>>(
        self,
        middleware: M
    ) -> Handler<E>
    where
        Self: 'static + Fn(Request, Context) -> Result<Response<Body>, E> + Sized
, { ... }
fn handler(self) -> Handler<HandlerError>
    where
        Self: 'static + Fn(Request, Context) -> Result<Response<Body>, E> + Sized,
        E: Send + Sync + Fail + From<Error>
, { ... } }

A trait that houses methods related to handlers that can be wrapped with middleware.

Provided methods

fn wrap_with<M: Fn(Handler<E>) -> Handler<E>>(self, middleware: M) -> Handler<E> where
    Self: 'static + Fn(Request, Context) -> Result<Response<Body>, E> + Sized

Wraps a Handler with the provided middleware, returning a new Handler.

fn handler(self) -> Handler<HandlerError> where
    Self: 'static + Fn(Request, Context) -> Result<Response<Body>, E> + Sized,
    E: Send + Sync + Fail + From<Error>, 

Returns a Handler that maps errors to HandlerError, suitable for passing directly to the lambda macro.

Loading content...

Implementors

impl<E> WrappingHandler<E> for Handler<E>[src]

Loading content...