[−][src]Trait actix_service::Transform
An asynchronous function for transforming service call result.
Associated Types
type Request
Requests handled by the service.
type Response
Responses given by the service.
type Error
Errors produced by the service.
type Future: Future<Item = Self::Response, Error = Self::Error>
The future response value.
Required methods
fn poll_ready(&mut self) -> Poll<(), Self::Error>
Returns Ready
when the service is able to process requests.
This method is similar to Service::poll_ready
method.
fn call(
&mut self,
request: Self::Request,
service: &mut Service
) -> Self::Future
&mut self,
request: Self::Request,
service: &mut Service
) -> Self::Future
Process the request and apply it to provided service, return the response asynchronously.
Provided methods
fn map_err<F, E>(self, f: F) -> TransformMapErr<Self, Service, F, E> where
Self: Sized,
F: Fn(Self::Error) -> E,
Self: Sized,
F: Fn(Self::Error) -> E,
Map this transform's error to a different error, returning a new transform.
This function is similar to the Result::map_err
where it will change
the error type of the underlying transform. This is useful for example to
ensure that services and transforms have the same error type.
Note that this function consumes the receiving transform and returns a wrapped version of it.
Implementations on Foreign Types
impl<'a, T, S> Transform<S> for &'a mut T where
T: Transform<S> + 'a,
S: Service<Error = T::Error>,
[src]
T: Transform<S> + 'a,
S: Service<Error = T::Error>,
type Request = T::Request
type Response = T::Response
type Error = T::Error
type Future = T::Future
fn poll_ready(&mut self) -> Poll<(), T::Error>
[src]
fn call(&mut self, request: Self::Request, service: &mut S) -> T::Future
[src]
fn map_err<F, E>(self, f: F) -> TransformMapErr<Self, Service, F, E> where
Self: Sized,
F: Fn(Self::Error) -> E,
[src]
Self: Sized,
F: Fn(Self::Error) -> E,
impl<T: ?Sized, S> Transform<S> for Box<T> where
T: Transform<S>,
S: Service<Error = T::Error>,
[src]
T: Transform<S>,
S: Service<Error = T::Error>,
type Request = T::Request
type Response = T::Response
type Error = T::Error
type Future = T::Future
fn poll_ready(&mut self) -> Poll<(), S::Error>
[src]
fn call(&mut self, request: Self::Request, service: &mut S) -> T::Future
[src]
fn map_err<F, E>(self, f: F) -> TransformMapErr<Self, Service, F, E> where
Self: Sized,
F: Fn(Self::Error) -> E,
[src]
Self: Sized,
F: Fn(Self::Error) -> E,
Implementors
impl<F, S, Req, Res> Transform<S> for FnTransform<F, S, Req, Res> where
F: FnMut(Req, &mut S) -> Res,
Res: IntoFuture,
[src]
F: FnMut(Req, &mut S) -> Res,
Res: IntoFuture,
type Request = Req
type Response = Res::Item
type Error = Res::Error
type Future = Res::Future
fn poll_ready(&mut self) -> Poll<(), Self::Error>
[src]
fn call(&mut self, request: Req, service: &mut S) -> Self::Future
[src]
fn map_err<F, E>(self, f: F) -> TransformMapErr<Self, Service, F, E> where
Self: Sized,
F: Fn(Self::Error) -> E,
[src]
Self: Sized,
F: Fn(Self::Error) -> E,