Struct tower_async::util::MapResponse
source · pub struct MapResponse<S, F> { /* private fields */ }
Available on crate feature
util
only.Expand description
Service returned by the map_response
combinator.
Implementations§
source§impl<S, F> MapResponse<S, F>
impl<S, F> MapResponse<S, F>
sourcepub fn layer(f: F) -> MapResponseLayer<F>
pub fn layer(f: F) -> MapResponseLayer<F>
Returns a new Layer
that produces MapResponse
services.
This is a convenience function that simply calls MapResponseLayer::new
.
Trait Implementations§
source§impl<S: Clone, F: Clone> Clone for MapResponse<S, F>
impl<S: Clone, F: Clone> Clone for MapResponse<S, F>
source§fn clone(&self) -> MapResponse<S, F>
fn clone(&self) -> MapResponse<S, F>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<S, F> Debug for MapResponse<S, F>where
S: Debug,
impl<S, F> Debug for MapResponse<S, F>where S: Debug,
Auto Trait Implementations§
impl<S, F> RefUnwindSafe for MapResponse<S, F>where F: RefUnwindSafe, S: RefUnwindSafe,
impl<S, F> Send for MapResponse<S, F>where F: Send, S: Send,
impl<S, F> Sync for MapResponse<S, F>where F: Sync, S: Sync,
impl<S, F> Unpin for MapResponse<S, F>where F: Unpin, S: Unpin,
impl<S, F> UnwindSafe for MapResponse<S, F>where F: UnwindSafe, S: 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<M, S, Target, Request> MakeService<Target, Request> for Mwhere
M: Service<Target, Response = S>,
S: Service<Request>,
impl<M, S, Target, Request> MakeService<Target, Request> for Mwhere M: Service<Target, Response = S>, S: Service<Request>,
§type Response = <S as Service<Request>>::Response
type Response = <S as Service<Request>>::Response
Available on crate feature
make
only.Responses given by the service
§type Error = <S as Service<Request>>::Error
type Error = <S as Service<Request>>::Error
Available on crate feature
make
only.Errors produced by the service
§type MakeError = <M as Service<Target>>::Error
type MakeError = <M as Service<Target>>::Error
Available on crate feature
make
only.Errors produced while building a service.
source§async fn make_service(
&self,
target: Target
) -> Result<<M as MakeService<Target, Request>>::Service, <M as MakeService<Target, Request>>::MakeError>
async fn make_service( &self, target: Target ) -> Result<<M as MakeService<Target, Request>>::Service, <M as MakeService<Target, Request>>::MakeError>
Available on crate feature
make
only.Create and return a new service value asynchronously.
source§fn into_service(self) -> IntoService<Self, Request>where
Self: Sized,
fn into_service(self) -> IntoService<Self, Request>where Self: Sized,
Available on crate feature
make
only.source§fn as_service(&self) -> AsService<'_, Self, Request>where
Self: Sized,
fn as_service(&self) -> AsService<'_, Self, Request>where Self: Sized,
Available on crate feature
make
only.source§impl<T, Request> ServiceExt<Request> for Twhere
T: Service<Request> + ?Sized,
impl<T, Request> ServiceExt<Request> for Twhere T: Service<Request> + ?Sized,
source§fn oneshot(
self,
req: Request
) -> impl Future<Output = Result<Self::Response, Self::Error>>where
Self: Sized,
fn oneshot( self, req: Request ) -> impl Future<Output = Result<Self::Response, Self::Error>>where Self: Sized,
Available on crate feature
util
only.Consume this
Service
, calling it with the provided request once and only once.source§fn and_then<F>(self, f: F) -> AndThen<Self, F>where
Self: Sized,
F: Clone,
fn and_then<F>(self, f: F) -> AndThen<Self, F>where Self: Sized, F: Clone,
Available on crate feature
util
only.Executes a new future after this service’s future resolves. Read more
source§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>where
Self: Sized,
F: Fn(Self::Response) -> Response,
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>where Self: Sized, F: Fn(Self::Response) -> Response,
Available on crate feature
util
only.Maps this service’s response value to a different value. Read more
source§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>where
Self: Sized,
F: Fn(Self::Error) -> Error,
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>where Self: Sized, F: Fn(Self::Error) -> Error,
Available on crate feature
util
only.Maps this service’s error value to a different value. Read more
source§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>where
Self: Sized,
Error: From<Self::Error>,
F: Fn(Result<Self::Response, Self::Error>) -> Result<Response, Error>,
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>where Self: Sized, Error: From<Self::Error>, F: Fn(Result<Self::Response, Self::Error>) -> Result<Response, Error>,
Available on crate feature
util
only.Maps this service’s result type (
Result<Self::Response, Self::Error>
)
to a different value, regardless of whether the future succeeds or
fails. Read moresource§fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>where
Self: Sized,
F: Fn(NewRequest) -> Request,
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>where Self: Sized, F: Fn(NewRequest) -> Request,
Available on crate feature
util
only.Composes a function in front of the service. Read more
source§fn filter<F, NewRequest>(self, filter: F) -> Filter<Self, F>where
Self: Sized,
F: Predicate<NewRequest>,
fn filter<F, NewRequest>(self, filter: F) -> Filter<Self, F>where Self: Sized, F: Predicate<NewRequest>,
Available on crate features
util
and filter
only.source§fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where
Self: Sized,
F: AsyncPredicate<NewRequest>,
fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where Self: Sized, F: AsyncPredicate<NewRequest>,
Available on crate features
util
and filter
only.Composes this service with an
AsyncFilter
that conditionally accepts or
rejects requests based on an [async predicate]. Read moresource§fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>where
Self: Sized,
Error: From<Self::Error>,
F: Fn(Result<Self::Response, Self::Error>) -> Fut,
Fut: Future<Output = Result<Response, Error>>,
fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>where Self: Sized, Error: From<Self::Error>, F: Fn(Result<Self::Response, Self::Error>) -> Fut, Fut: Future<Output = Result<Response, Error>>,
Available on crate feature
util
only.Composes an asynchronous function after this service. Read more