Skip to main content

WrappingHandler

Trait WrappingHandler 

Source
pub trait WrappingHandler<E> {
    // 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 { ... }
    fn handler(self) -> Handler<HandlerError>
       where Self: 'static + Fn(Request, Context) -> Result<Response<Body>, E> + Sized,
             E: Send + Sync + Fail + From<Error> { ... }
}
Expand description

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

Provided Methods§

Source

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.

Source

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§