Trait tokio_proto::BindClient [−][src]
pub trait BindClient<Kind, T: 'static>: 'static { type ServiceRequest; type ServiceResponse; type ServiceError; type BindClient: Service<Request = Self::ServiceRequest, Response = Self::ServiceResponse, Error = Self::ServiceError>; fn bind_client<E>(&self, executor: &E, io: T) -> Self::BindClient
where
E: Executor<Box<Future<Item = (), Error = ()>>>; }
Binds an I/O object as a client of a service.
This trait is not intended to be implemented directly; instead, implement one of the client protocol traits:
pipeline::ClientProto
multiplex::ClientProto
streaming::pipeline::ClientProto
streaming::multiplex::ClientProto
See the crate documentation for more details on those traits.
The Kind
parameter, in particular, is a zero-sized type used to allow
blanket implementation from the various protocol traits. Any additional
implementations of this trait should use their own zero-sized kind type to
distinguish them.
Associated Types
type ServiceRequest
The request type for the service.
type ServiceResponse
The response type for the service.
type ServiceError
The error type for the service.
type BindClient: Service<Request = Self::ServiceRequest, Response = Self::ServiceResponse, Error = Self::ServiceError>
The bound service.
Required Methods
fn bind_client<E>(&self, executor: &E, io: T) -> Self::BindClient where
E: Executor<Box<Future<Item = (), Error = ()>>>,
E: Executor<Box<Future<Item = (), Error = ()>>>,
Bind an I/O object as a service.
Implementors
impl<T: 'static, P: ClientProto<T>> BindClient<Pipeline, T> for P type ServiceRequest = P::Request; type ServiceResponse = P::Response; type ServiceError = Error; type BindClient = ClientService<T, P>;
impl<T: 'static, P: ClientProto<T>> BindClient<Multiplex, T> for P type ServiceRequest = P::Request; type ServiceResponse = P::Response; type ServiceError = Error; type BindClient = ClientService<T, P>;
impl<P, T, B> BindClient<StreamingPipeline<B>, T> for P where
P: ClientProto<T>,
T: 'static,
B: Stream<Item = P::RequestBody, Error = P::Error> + 'static, type ServiceRequest = Message<P::Request, B>; type ServiceResponse = Message<P::Response, Body<P::ResponseBody, P::Error>>; type ServiceError = P::Error; type BindClient = ClientProxy<Self::ServiceRequest, Self::ServiceResponse, Self::ServiceError>;impl<P, T, B> BindClient<StreamingMultiplex<B>, T> for P where
P: ClientProto<T>,
T: 'static,
B: Stream<Item = P::RequestBody, Error = P::Error> + 'static, type ServiceRequest = Message<P::Request, B>; type ServiceResponse = Message<P::Response, Body<P::ResponseBody, P::Error>>; type ServiceError = P::Error; type BindClient = ClientProxy<Self::ServiceRequest, Self::ServiceResponse, Self::ServiceError>;