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
sourceimpl<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,
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.
sourcefn 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.
sourcefn layer<L, NewReqBody>(self, layer: L) -> Layered<L, Self, T, S, B, NewReqBody>where
L: Layer<HandlerService<Self, T, S, B>> + Clone,
L::Service: Service<Request<NewReqBody>>,
fn layer<L, NewReqBody>(self, layer: L) -> Layered<L, Self, T, S, B, NewReqBody>where
L: Layer<HandlerService<Self, T, S, B>> + Clone,
L::Service: Service<Request<NewReqBody>>,
Apply a
tower::Layer
to the handler. Read moresourcefn 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> RefUnwindSafe for Layered<L, H, T, S, B, B2>where
H: RefUnwindSafe,
L: RefUnwindSafe,
impl<L, H, T, S, B, B2> Send for Layered<L, H, T, S, B, B2>where
H: Send,
L: Send,
impl<L, H, T, S, B, B2> Sync for Layered<L, H, T, S, B, B2>where
H: Sync,
L: Sync,
impl<L, H, T, S, B, B2> Unpin for Layered<L, H, T, S, B, B2>where
H: Unpin,
L: Unpin,
impl<L, H, T, S, B, B2> UnwindSafe for Layered<L, H, T, S, B, B2>where
H: UnwindSafe,
L: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<H, T, B> HandlerWithoutStateExt<T, B> for Hwhere
H: Handler<T, (), B>,
impl<H, T, B> HandlerWithoutStateExt<T, B> for Hwhere
H: Handler<T, (), B>,
sourcefn into_service(self) -> HandlerService<H, T, (), B>
fn into_service(self) -> HandlerService<H, T, (), B>
Convert the handler into a
Service
and no state.sourcefn 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