[−][src]Trait actix_service::ServiceFactory
Factory for creating Service
s.
Acts as a service factory. This is useful for cases where new Service
s
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
type Response
[src]
Responses given by the created services.
type Error
[src]
Errors produced by the created services.
type Config
[src]
Service factory configuration.
type Service: Service<Req, Response = Self::Response, Error = Self::Error>
[src]
The kind of Service
created by this factory.
type InitError
[src]
Errors potentially raised while building a service.
type Future: Future<Output = Result<Self::Service, Self::InitError>>
[src]
The future of the Service
instance.
Required methods
pub fn new_service(&self, cfg: Self::Config) -> Self::Future
[src]
Create and return a new service asynchronously.
Implementations on Foreign Types
impl<S, Req> ServiceFactory<Req> for Rc<S> where
S: ServiceFactory<Req>,
[src]
S: ServiceFactory<Req>,
type Response = S::Response
type Error = S::Error
type Config = S::Config
type Service = S::Service
type InitError = S::InitError
type Future = S::Future
pub fn new_service(&self, cfg: S::Config) -> S::Future
[src]
impl<S, Req> ServiceFactory<Req> for Arc<S> where
S: ServiceFactory<Req>,
[src]
S: ServiceFactory<Req>,
type Response = S::Response
type Error = S::Error
type Config = S::Config
type Service = S::Service
type InitError = S::InitError
type Future = S::Future
pub fn new_service(&self, cfg: S::Config) -> S::Future
[src]
Implementors
impl<A, F, Req, E> ServiceFactory<Req> for MapInitErr<A, F, Req, E> where
A: ServiceFactory<Req>,
F: Fn(A::InitError) -> E + Clone,
[src]
A: ServiceFactory<Req>,
F: Fn(A::InitError) -> E + Clone,
type Response = A::Response
type Error = A::Error
type Config = A::Config
type Service = A::Service
type InitError = E
type Future = MapInitErrFuture<A, F, Req, E>
pub fn new_service(&self, cfg: A::Config) -> Self::Future
[src]
impl<A, F, Req, Res> ServiceFactory<Req> for MapServiceFactory<A, F, Req, Res> where
A: ServiceFactory<Req>,
F: FnMut(A::Response) -> Res + Clone,
[src]
A: ServiceFactory<Req>,
F: FnMut(A::Response) -> Res + Clone,
type Response = Res
type Error = A::Error
type Config = A::Config
type Service = Map<A::Service, F, Req, Res>
type InitError = A::InitError
type Future = MapServiceFuture<A, F, Req, Res>
pub fn new_service(&self, cfg: A::Config) -> Self::Future
[src]
impl<A, Req, F, E> ServiceFactory<Req> for MapErrServiceFactory<A, Req, F, E> where
A: ServiceFactory<Req>,
F: Fn(A::Error) -> E + Clone,
[src]
A: ServiceFactory<Req>,
F: Fn(A::Error) -> E + Clone,
type Response = A::Response
type Error = E
type Config = A::Config
type Service = MapErr<A::Service, Req, F, E>
type InitError = A::InitError
type Future = MapErrServiceFuture<A, Req, F, E>
pub fn new_service(&self, cfg: A::Config) -> Self::Future
[src]
impl<C, Req, Res, Err, InitErr> ServiceFactory<Req> for BoxServiceFactory<C, Req, Res, Err, InitErr> where
Req: 'static,
Res: 'static,
Err: 'static,
InitErr: 'static,
[src]
Req: 'static,
Res: 'static,
Err: 'static,
InitErr: 'static,
type Response = Res
type Error = Err
type InitError = InitErr
type Config = C
type Service = BoxService<Req, Res, Err>
type Future = BoxFuture<Result<Self::Service, InitErr>>
pub fn new_service(&self, cfg: C) -> Self::Future
[src]
impl<F, Cfg, Srv, Req, Fut, Err> ServiceFactory<Req> for FnServiceNoConfig<F, Cfg, Srv, Req, Fut, Err> where
F: Fn() -> Fut,
Fut: Future<Output = Result<Srv, Err>>,
Srv: Service<Req>,
[src]
F: Fn() -> Fut,
Fut: Future<Output = Result<Srv, Err>>,
Srv: Service<Req>,
type Response = Srv::Response
type Error = Srv::Error
type Service = Srv
type Config = Cfg
type InitError = Err
type Future = Fut
pub fn new_service(&self, _: Cfg) -> Self::Future
[src]
impl<F, Fut, Cfg, Srv, Req, Err> ServiceFactory<Req> for FnServiceConfig<F, Fut, Cfg, Srv, Req, Err> where
F: Fn(Cfg) -> Fut,
Fut: Future<Output = Result<Srv, Err>>,
Srv: Service<Req>,
[src]
F: Fn(Cfg) -> Fut,
Fut: Future<Output = Result<Srv, Err>>,
Srv: Service<Req>,
type Response = Srv::Response
type Error = Srv::Error
type Config = Cfg
type Service = Srv
type InitError = Err
type Future = Fut
pub fn new_service(&self, cfg: Cfg) -> Self::Future
[src]
impl<F, Fut, Req, Res, Err, Cfg> ServiceFactory<Req> for FnServiceFactory<F, Fut, Req, Res, Err, Cfg> where
F: FnMut(Req) -> Fut + Clone,
Fut: Future<Output = Result<Res, Err>>,
[src]
F: FnMut(Req) -> Fut + Clone,
Fut: Future<Output = Result<Res, Err>>,
type Response = Res
type Error = Err
type Config = Cfg
type Service = FnService<F, Fut, Req, Res, Err>
type InitError = ()
type Future = Ready<Result<Self::Service, Self::InitError>>
pub fn new_service(&self, _: Cfg) -> Self::Future
[src]
impl<SF, Cfg, Req> ServiceFactory<Req> for UnitConfig<SF, Cfg, Req> where
SF: ServiceFactory<Req, Config = ()>,
[src]
SF: ServiceFactory<Req, Config = ()>,
type Response = SF::Response
type Error = SF::Error
type Config = Cfg
type Service = SF::Service
type InitError = SF::InitError
type Future = SF::Future
pub fn new_service(&self, _: Cfg) -> Self::Future
[src]
impl<SF, F, Fut, Req, In, Res, Err> ServiceFactory<Req> for ApplyFactory<SF, F, Req, In, Res, Err> where
SF: ServiceFactory<In, Error = Err>,
F: FnMut(Req, &mut SF::Service) -> Fut + Clone,
Fut: Future<Output = Result<Res, Err>>,
[src]
SF: ServiceFactory<In, Error = Err>,
F: FnMut(Req, &mut SF::Service) -> Fut + Clone,
Fut: Future<Output = Result<Res, Err>>,
type Response = Res
type Error = Err
type Config = SF::Config
type Service = Apply<SF::Service, F, Req, In, Res, Err>
type InitError = SF::InitError
type Future = ApplyServiceFactoryResponse<SF, F, Fut, Req, In, Res, Err>
pub fn new_service(&self, cfg: SF::Config) -> Self::Future
[src]
impl<SF, Req> ServiceFactory<Req> for PipelineFactory<SF, Req> where
SF: ServiceFactory<Req>,
[src]
SF: ServiceFactory<Req>,
type Config = SF::Config
type Response = SF::Response
type Error = SF::Error
type Service = SF::Service
type InitError = SF::InitError
type Future = SF::Future
pub fn new_service(&self, cfg: SF::Config) -> Self::Future
[src]
impl<SF, Req, F, Cfg> ServiceFactory<Req> for MapConfig<SF, Req, F, Cfg> where
SF: ServiceFactory<Req>,
F: Fn(Cfg) -> SF::Config,
[src]
SF: ServiceFactory<Req>,
F: Fn(Cfg) -> SF::Config,
type Response = SF::Response
type Error = SF::Error
type Config = Cfg
type Service = SF::Service
type InitError = SF::InitError
type Future = SF::Future
pub fn new_service(&self, cfg: Self::Config) -> Self::Future
[src]
impl<T, S, Req> ServiceFactory<Req> for ApplyTransform<T, S, Req> where
S: ServiceFactory<Req>,
T: Transform<S::Service, Req, InitError = S::InitError>,
[src]
S: ServiceFactory<Req>,
T: Transform<S::Service, Req, InitError = S::InitError>,