Trait actix_service::ServiceFactory[][src]

pub trait ServiceFactory {
    type Request;
    type Response;
    type Error;
    type Config;
    type Service: Service<Request = Self::Request, Response = Self::Response, Error = Self::Error>;
    type InitError;
    type Future: Future<Output = Result<Self::Service, Self::InitError>>;
    fn new_service(&self, cfg: Self::Config) -> Self::Future;

    fn map<F, R>(self, f: F) -> MapServiceFactory<Self, F, R>
    where
        Self: Sized,
        F: FnMut(Self::Response) -> R + Clone
, { ... }
fn map_err<F, E>(self, f: F) -> MapErrServiceFactory<Self, F, E>
    where
        Self: Sized,
        F: Fn(Self::Error) -> E + Clone
, { ... }
fn map_init_err<F, E>(self, f: F) -> MapInitErr<Self, F, E>
    where
        Self: Sized,
        F: Fn(Self::InitError) -> E + Clone
, { ... } }
Expand description

Factory for creating Services.

Acts as a service factory. This is useful for cases where new Services must be produced. One case is a TCP server listener. The listener accepts new TCP streams, obtains a new Service using the ServiceFactory trait, and uses the new Service to process inbound requests on that new TCP stream.

Config is a service factory configuration type.

Associated Types

Requests handled by the created services.

Responses given by the created services.

Errors produced by the created services.

Service factory configuration.

The kind of Service created by this factory.

Errors potentially raised while building a service.

The future of the Service instance.

Required methods

Create and return a new service asynchronously.

Provided methods

Map this service’s output to a different type, returning a new service of the resulting type.

Map this service’s error to a different error, returning a new service.

Map this factory’s init error to a different error, returning a new service.

Implementations on Foreign Types

Implementors