Trait tower_service::NewService [−][src]
pub trait NewService { type Request; type Response; type Error; type Service: Service<Request = Self::Request, Response = Self::Response, Error = Self::Error>; type InitError; type Future: Future<Item = Self::Service, Error = Self::InitError>; fn new_service(&self) -> Self::Future; }
Creates new Service
values.
Acts as a service factory. This is useful for cases where new Service
values must be produced. One case is a TCP servier listener. The listner
accepts new TCP streams, obtains a new Service
value using the
NewService
trait, and uses that new Service
value to process inbound
requests on that new TCP stream.
Associated Types
type Request
Requests handled by the service
type Response
Responses given by the service
type Error
Errors produced by the service
type Service: Service<Request = Self::Request, Response = Self::Response, Error = Self::Error>
The Service
value created by this factory
type InitError
Errors produced while building a service.
type Future: Future<Item = Self::Service, Error = Self::InitError>
The future of the Service
instance.
Required Methods
fn new_service(&self) -> Self::Future
Create and return a new service value asynchronously.
Implementations on Foreign Types
impl<S: NewService + ?Sized> NewService for Arc<S>
[src]
impl<S: NewService + ?Sized> NewService for Arc<S>
impl<S: NewService + ?Sized> NewService for Rc<S>
[src]
impl<S: NewService + ?Sized> NewService for Rc<S>