Struct axum_extra::handler::Or
source · 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,
§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,
§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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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 moresource§fn into_make_service_with_connect_info<C>(
self,
) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
fn into_make_service_with_connect_info<C>( self, ) -> IntoMakeServiceWithConnectInfo<HandlerService<H, T, ()>, C>
Convert the handler into a
MakeService
which stores information
about the incoming connection and has no state. Read more