pub struct Layered<L, H, T, S, B, B2> { /* private fields */ }
Expand description
A Service
created from a Handler
by applying a Tower middleware.
Created with Handler::layer
. See that method for more details.
Trait Implementations§
source§impl<H, S, T, L, B, B2> Handler<T, S, B2> for Layered<L, H, T, S, B, B2>where
L: Layer<HandlerService<H, T, S, B>> + Clone + Send + 'static,
H: Handler<T, S, B>,
L::Service: Service<Request<B2>, Error = Infallible> + Clone + Send + 'static,
<L::Service as Service<Request<B2>>>::Response: IntoResponse,
<L::Service as Service<Request<B2>>>::Future: Send,
T: 'static,
S: 'static,
B: Send + 'static,
B2: Send + 'static,
impl<H, S, T, L, B, B2> Handler<T, S, B2> for Layered<L, H, T, S, B, B2>where
L: Layer<HandlerService<H, T, S, B>> + Clone + Send + 'static,
H: Handler<T, S, B>,
L::Service: Service<Request<B2>, Error = Infallible> + Clone + Send + 'static,
<L::Service as Service<Request<B2>>>::Response: IntoResponse,
<L::Service as Service<Request<B2>>>::Future: Send,
T: 'static,
S: 'static,
B: Send + 'static,
B2: Send + 'static,
source§type Future = LayeredFuture<B2, <L as Layer<HandlerService<H, T, S, B>>>::Service>
type Future = LayeredFuture<B2, <L as Layer<HandlerService<H, T, S, B>>>::Service>
The type of future calling this handler returns.
source§fn call(self, req: Request<B2>, state: S) -> Self::Future
fn call(self, req: Request<B2>, state: S) -> Self::Future
Call the handler with the given request.
source§fn layer<L, NewReqBody>(self, layer: L) -> Layered<L, Self, T, S, B, NewReqBody>
fn layer<L, NewReqBody>(self, layer: L) -> Layered<L, Self, T, S, B, NewReqBody>
Apply a
tower::Layer
to the handler. Read moresource§fn with_state(self, state: S) -> HandlerService<Self, T, S, B>
fn with_state(self, state: S) -> HandlerService<Self, T, S, B>
Convert the handler into a
Service
by providing the stateAuto Trait Implementations§
impl<L, H, T, S, B, B2> Freeze for Layered<L, H, T, S, B, B2>
impl<L, H, T, S, B, B2> RefUnwindSafe for Layered<L, H, T, S, B, B2>where
L: RefUnwindSafe,
H: RefUnwindSafe,
impl<L, H, T, S, B, B2> Send for Layered<L, H, T, S, B, B2>
impl<L, H, T, S, B, B2> Sync for Layered<L, H, T, S, B, B2>
impl<L, H, T, S, B, B2> Unpin for Layered<L, H, T, S, B, B2>
impl<L, H, T, S, B, B2> UnwindSafe for Layered<L, H, T, S, B, B2>where
L: UnwindSafe,
H: 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§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, B> HandlerWithoutStateExt<T, B> for H
impl<H, T, B> HandlerWithoutStateExt<T, B> for H
source§fn into_service(self) -> HandlerService<H, T, (), B>
fn into_service(self) -> HandlerService<H, T, (), B>
Convert the handler into a
Service
and no state.source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, (), B>>
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, (), B>>
Convert the handler into a
MakeService
and no state. Read more