[][src]Trait actix_service::Transform

pub trait Transform<S> {
    type Request;
    type Response;
    type Error;
    type Transform: Service<Request = Self::Request, Response = Self::Response, Error = Self::Error>;
    type InitError;
    type Future: Future<Item = Self::Transform, Error = Self::InitError>;
    fn new_transform(&self, service: S) -> Self::Future;

    fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E>
    where
        Self: Sized,
        F: Fn(Self::InitError) -> E
, { ... }
fn from_err<E>(self) -> TransformFromErr<Self, S, E>
    where
        Self: Sized,
        E: From<Self::InitError>
, { ... } }

The Transform trait defines the interface of a Service factory. Transform is often implemented for middleware, defining how to manufacture a middleware Service. A Service that is manufactured by the factory takes the Service that follows it during execution as a parameter, assuming ownership of the next Service. A Service can be a variety of types, such as (but not limited to) another middleware Service, an extractor Service, other helper Services, or the request handler endpoint Service.

A Service is created by the factory during server initialization.

Config is a service factory configuration type.

Associated Types

type Request

Requests handled by the service.

type Response

Responses given by the service.

type Error

Errors produced by the service.

type Transform: Service<Request = Self::Request, Response = Self::Response, Error = Self::Error>

The TransformService value created by this factory

type InitError

Errors produced while building a service.

type Future: Future<Item = Self::Transform, Error = Self::InitError>

The future response value.

Loading content...

Required methods

fn new_transform(&self, service: S) -> Self::Future

Creates and returns a new Service component, asynchronously

Loading content...

Provided methods

fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
    Self: Sized,
    F: Fn(Self::InitError) -> E, 

Map this service's factory error to a different error, returning a new transform service factory.

fn from_err<E>(self) -> TransformFromErr<Self, S, E> where
    Self: Sized,
    E: From<Self::InitError>, 

Map this service's init error to any error implementing From for this services Error`.

Note that this function consumes the receiving transform and returns a wrapped version of it.

Loading content...

Implementations on Foreign Types

impl<T, S> Transform<S> for Rc<T> where
    T: Transform<S>, 
[src]

type Request = T::Request

type Response = T::Response

type Error = T::Error

type InitError = T::InitError

type Transform = T::Transform

type Future = T::Future

fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
    Self: Sized,
    F: Fn(Self::InitError) -> E, 
[src]

fn from_err<E>(self) -> TransformFromErr<Self, S, E> where
    Self: Sized,
    E: From<Self::InitError>, 
[src]

impl<T, S> Transform<S> for Arc<T> where
    T: Transform<S>, 
[src]

type Request = T::Request

type Response = T::Response

type Error = T::Error

type InitError = T::InitError

type Transform = T::Transform

type Future = T::Future

fn map_init_err<F, E>(self, f: F) -> TransformMapInitErr<Self, S, F, E> where
    Self: Sized,
    F: Fn(Self::InitError) -> E, 
[src]

fn from_err<E>(self) -> TransformFromErr<Self, S, E> where
    Self: Sized,
    E: From<Self::InitError>, 
[src]

Loading content...

Implementors

Loading content...