pub struct Or<L, R, Lt, Rt, S> { /* private fields */ }
Expand description
Handler
that runs one Handler
and if that rejects it’ll fallback to another
Handler
.
Created with HandlerCallWithExtractors::or
.
Trait Implementations§
Source§impl<S, L, R, Lt, Rt, M> Handler<(M, Lt, Rt), S> for Or<L, R, Lt, Rt, S>where
L: HandlerCallWithExtractors<Lt, S> + Clone + Send + 'static,
R: HandlerCallWithExtractors<Rt, S> + Clone + Send + 'static,
Lt: FromRequestParts<S> + Send + 'static,
Rt: FromRequest<S, M> + Send + 'static,
Lt::Rejection: Send,
Rt::Rejection: Send,
S: Send + Sync + 'static,
impl<S, L, R, Lt, Rt, M> Handler<(M, Lt, Rt), S> for Or<L, R, Lt, Rt, S>where
L: HandlerCallWithExtractors<Lt, S> + Clone + Send + 'static,
R: HandlerCallWithExtractors<Rt, S> + Clone + Send + 'static,
Lt: FromRequestParts<S> + Send + 'static,
Rt: FromRequest<S, M> + Send + 'static,
Lt::Rejection: Send,
Rt::Rejection: Send,
S: Send + Sync + 'static,
Source§type Future = Pin<Box<dyn Future<Output = Response<Body>> + Send>>
type Future = Pin<Box<dyn Future<Output = Response<Body>> + Send>>
The type of future calling this handler returns.
Source§fn call(self, req: Request, state: S) -> Self::Future
fn call(self, req: Request, state: S) -> Self::Future
Call the handler with the given request.
Source§fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
fn layer<L>(self, layer: L) -> Layered<L, Self, T, S>where
L: Layer<HandlerService<Self, T, S>> + Clone,
<L as Layer<HandlerService<Self, T, S>>>::Service: Service<Request<Body>>,
Apply a
tower::Layer
to the handler. Read moreSource§fn with_state(self, state: S) -> HandlerService<Self, T, S>
fn with_state(self, state: S) -> HandlerService<Self, T, S>
Convert the handler into a
Service
by providing the stateSource§impl<S, L, R, Lt, Rt> HandlerCallWithExtractors<Either<Lt, Rt>, S> for Or<L, R, Lt, Rt, S>where
L: HandlerCallWithExtractors<Lt, S> + Send + 'static,
R: HandlerCallWithExtractors<Rt, S> + Send + 'static,
Rt: Send + 'static,
Lt: Send + 'static,
impl<S, L, R, Lt, Rt> HandlerCallWithExtractors<Either<Lt, Rt>, S> for Or<L, R, Lt, Rt, S>where
L: HandlerCallWithExtractors<Lt, S> + Send + 'static,
R: HandlerCallWithExtractors<Rt, S> + Send + 'static,
Rt: Send + 'static,
Lt: Send + 'static,
Source§type Future = Either<Map<<L as HandlerCallWithExtractors<Lt, S>>::Future, fn(_: <<L as HandlerCallWithExtractors<Lt, S>>::Future as Future>::Output) -> Response<Body>>, Map<<R as HandlerCallWithExtractors<Rt, S>>::Future, fn(_: <<R as HandlerCallWithExtractors<Rt, S>>::Future as Future>::Output) -> Response<Body>>>
type Future = Either<Map<<L as HandlerCallWithExtractors<Lt, S>>::Future, fn(_: <<L as HandlerCallWithExtractors<Lt, S>>::Future as Future>::Output) -> Response<Body>>, Map<<R as HandlerCallWithExtractors<Rt, S>>::Future, fn(_: <<R as HandlerCallWithExtractors<Rt, S>>::Future as Future>::Output) -> Response<Body>>>
The type of future calling this handler returns.
Source§fn call(
self,
extractors: Either<Lt, Rt>,
state: S,
) -> <Self as HandlerCallWithExtractors<Either<Lt, Rt>, S>>::Future
fn call( self, extractors: Either<Lt, Rt>, state: S, ) -> <Self as HandlerCallWithExtractors<Either<Lt, Rt>, S>>::Future
Call the handler with the extracted inputs.
Source§fn into_handler(self) -> IntoHandler<Self, T, S>
fn into_handler(self) -> IntoHandler<Self, T, S>
Convert this
HandlerCallWithExtractors
into Handler
.impl<L, R, Lt, Rt, S> Copy for Or<L, R, Lt, Rt, S>
Auto Trait Implementations§
impl<L, R, Lt, Rt, S> Freeze for Or<L, R, Lt, Rt, S>
impl<L, R, Lt, Rt, S> RefUnwindSafe for Or<L, R, Lt, Rt, S>where
L: RefUnwindSafe,
R: RefUnwindSafe,
impl<L, R, Lt, Rt, S> Send for Or<L, R, Lt, Rt, S>
impl<L, R, Lt, Rt, S> Sync for Or<L, R, Lt, Rt, S>
impl<L, R, Lt, Rt, S> Unpin for Or<L, R, Lt, Rt, S>
impl<L, R, Lt, Rt, S> UnwindSafe for Or<L, R, Lt, Rt, S>where
L: UnwindSafe,
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<H, T> HandlerWithoutStateExt<T> for H
impl<H, T> HandlerWithoutStateExt<T> for H
Source§fn into_service(self) -> HandlerService<H, T, ()>
fn into_service(self) -> HandlerService<H, T, ()>
Convert the handler into a
Service
and no state.Source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, ()>>
Convert the handler into a
MakeService
and no state. Read more