[][src]Trait actix_service::Transform

pub trait Transform<Service> {
    type Request;
    type Response;
    type Error;
    type Future: Future<Item = Self::Response, Error = Self::Error>;
    fn poll_ready(&mut self) -> Poll<(), Self::Error>;
fn call(
        &mut self,
        request: Self::Request,
        service: &mut Service
    ) -> Self::Future; fn map_err<F, E>(self, f: F) -> TransformMapErr<Self, Service, F, E>
    where
        Self: Sized,
        F: Fn(Self::Error) -> E
, { ... } }

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.

Loading content...

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

Process the request and apply it to provided service, return the response asynchronously.

Loading content...

Provided methods

fn map_err<F, E>(self, f: F) -> TransformMapErr<Self, Service, F, E> where
    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.

Loading content...

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]

type Request = T::Request

type Response = T::Response

type Error = T::Error

type Future = T::Future

fn map_err<F, E>(self, f: F) -> TransformMapErr<Self, Service, F, E> where
    Self: Sized,
    F: Fn(Self::Error) -> E, 
[src]

impl<T: ?Sized, S> Transform<S> for Box<T> where
    T: Transform<S>,
    S: Service<Error = T::Error>, 
[src]

type Request = T::Request

type Response = T::Response

type Error = T::Error

type Future = T::Future

fn map_err<F, E>(self, f: F) -> TransformMapErr<Self, Service, F, E> where
    Self: Sized,
    F: Fn(Self::Error) -> E, 
[src]

Loading content...

Implementors

impl<F, S, Req, Res> Transform<S> for FnTransform<F, S, Req, Res> where
    F: FnMut(Req, &mut S) -> Res,
    Res: IntoFuture
[src]

type Request = Req

type Response = Res::Item

type Error = Res::Error

type Future = Res::Future

fn map_err<F, E>(self, f: F) -> TransformMapErr<Self, Service, F, E> where
    Self: Sized,
    F: Fn(Self::Error) -> E, 
[src]

Loading content...