Trait viz::HandlerExt
source · pub trait HandlerExt<I>: Handler<I> {
Show 14 methods
// Provided methods
fn before<F>(self, f: F) -> Before<Self, F>
where Self: Sized { ... }
fn after<F>(self, f: F) -> After<Self, F>
where Self: Sized { ... }
fn around<F>(self, f: F) -> Around<Self, F>
where Self: Sized { ... }
fn either<R>(self, r: R, enable: bool) -> Either<Self, R>
where Self: Sized { ... }
fn map<F>(self, f: F) -> Map<Self, F>
where Self: Sized { ... }
fn map_into_response(self) -> MapInToResponse<Self>
where Self: Sized { ... }
fn and_then<F>(self, f: F) -> AndThen<Self, F>
where Self: Sized { ... }
fn map_err<F>(self, f: F) -> MapErr<Self, F>
where Self: Sized { ... }
fn or_else<F>(self, f: F) -> OrElse<Self, F>
where Self: Sized { ... }
fn catch_error<F, E, R>(self, f: F) -> CatchError<Self, F, E, R>
where Self: Sized { ... }
fn catch_unwind<F>(self, f: F) -> CatchUnwind<Self, F>
where Self: Sized { ... }
fn boxed(self) -> BoxHandler<I, Self::Output>
where Self: Sized + Clone { ... }
fn with<T>(self, t: T) -> <T as Transform<Self>>::Output
where T: Transform<Self>,
Self: Sized { ... }
fn with_fn<F>(self, f: F) -> Self
where F: Fn(Self) -> Self,
Self: Sized { ... }
}
Expand description
The HandlerExt
trait, which provides adapters for chaining and composing handlers.
Provided Methods§
sourcefn before<F>(self, f: F) -> Before<Self, F>where
Self: Sized,
fn before<F>(self, f: F) -> Before<Self, F>where
Self: Sized,
Maps the input before the handler calls.
sourcefn after<F>(self, f: F) -> After<Self, F>where
Self: Sized,
fn after<F>(self, f: F) -> After<Self, F>where
Self: Sized,
Maps the output Result<T>
after the handler called.
sourcefn around<F>(self, f: F) -> Around<Self, F>where
Self: Sized,
fn around<F>(self, f: F) -> Around<Self, F>where
Self: Sized,
Wraps around the remaining handler or middleware chain.
sourcefn either<R>(self, r: R, enable: bool) -> Either<Self, R>where
Self: Sized,
fn either<R>(self, r: R, enable: bool) -> Either<Self, R>where
Self: Sized,
Wraps this handler in an Either handler, making it the left-hand variant of that Either.
Returns the left-hand variant if enable
is true, otherwise returns the right-hand
variant.
sourcefn map<F>(self, f: F) -> Map<Self, F>where
Self: Sized,
fn map<F>(self, f: F) -> Map<Self, F>where
Self: Sized,
Maps the Ok
value of the output if after the handler called.
sourcefn map_into_response(self) -> MapInToResponse<Self>where
Self: Sized,
fn map_into_response(self) -> MapInToResponse<Self>where
Self: Sized,
Maps the handler’s output type to the Response
.
sourcefn and_then<F>(self, f: F) -> AndThen<Self, F>where
Self: Sized,
fn and_then<F>(self, f: F) -> AndThen<Self, F>where
Self: Sized,
Calls op if the result is Ok, otherwise returns the Err value of self.
sourcefn map_err<F>(self, f: F) -> MapErr<Self, F>where
Self: Sized,
fn map_err<F>(self, f: F) -> MapErr<Self, F>where
Self: Sized,
Maps the Err
value of the output if after the handler called.
sourcefn or_else<F>(self, f: F) -> OrElse<Self, F>where
Self: Sized,
fn or_else<F>(self, f: F) -> OrElse<Self, F>where
Self: Sized,
Calls op
if the output is Err
, otherwise returns the Ok
value of the output.
sourcefn catch_error<F, E, R>(self, f: F) -> CatchError<Self, F, E, R>where
Self: Sized,
fn catch_error<F, E, R>(self, f: F) -> CatchError<Self, F, E, R>where
Self: Sized,
Catches rejected error while calling the handler.
sourcefn catch_unwind<F>(self, f: F) -> CatchUnwind<Self, F>where
Self: Sized,
fn catch_unwind<F>(self, f: F) -> CatchUnwind<Self, F>where
Self: Sized,
Catches unwinding panics while calling the handler.
sourcefn boxed(self) -> BoxHandler<I, Self::Output>
fn boxed(self) -> BoxHandler<I, Self::Output>
Converts this Handler into a BoxHandler
.