[−][src]Struct tokio_tower::pipeline::client::Client
This type provides an implementation of a Tower
Service
on top of a
request-at-a-time protocol transport. In particular, it wraps a transport that implements
Sink<SinkItem = Request>
and Stream<Item = Response>
with the necessary bookkeeping to
adhere to Tower's convenient fn(Request) -> Future<Response>
API.
Methods
impl<T, E, Request> Client<T, E, Request> where
T: Sink<Request> + TryStream + Send + 'static,
E: From<Error<T, Request>>,
E: 'static + Send,
Request: 'static + Send,
T::Ok: 'static + Send,
[src]
T: Sink<Request> + TryStream + Send + 'static,
E: From<Error<T, Request>>,
E: 'static + Send,
Request: 'static + Send,
T::Ok: 'static + Send,
pub fn new(transport: T) -> Self
[src]
Construct a new Client
over the given transport
.
If the Client errors, the error is dropped when new
is used -- use with_error_handler
to handle such an error explicitly.
pub fn with_error_handler<F>(transport: T, on_service_error: F) -> Self where
F: FnOnce(E) + Send + 'static,
[src]
F: FnOnce(E) + Send + 'static,
Construct a new Client
over the given transport
.
If the Client
errors, its error is passed to on_service_error
.
Trait Implementations
impl<T, E, Request> Debug for Client<T, E, Request> where
T: Sink<Request> + TryStream,
[src]
T: Sink<Request> + TryStream,
impl<T, E, Request> Load for Client<T, E, Request> where
T: Sink<Request> + TryStream,
[src]
T: Sink<Request> + TryStream,
type Metric = usize
A comparable load metric. Lesser values are "preferable" to greater values.
fn load(&self) -> Self::Metric
[src]
impl<T, E, Request> Service<Request> for Client<T, E, Request> where
T: Sink<Request> + TryStream,
E: From<Error<T, Request>>,
E: 'static + Send,
Request: 'static + Send,
T: 'static,
T::Ok: 'static + Send,
[src]
T: Sink<Request> + TryStream,
E: From<Error<T, Request>>,
E: 'static + Send,
Request: 'static + Send,
T: 'static,
T::Ok: 'static + Send,
type Response = T::Ok
Responses given by the service.
type Error = E
Errors produced by the service.
type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send>>
The future response value.
fn poll_ready(&mut self, cx: &mut Context) -> Poll<Result<(), E>>
[src]
fn call(&mut self, req: Request) -> Self::Future
[src]
Auto Trait Implementations
impl<T, E, Request> !RefUnwindSafe for Client<T, E, Request>
impl<T, E, Request> Send for Client<T, E, Request> where
Request: Send,
<T as TryStream>::Ok: Send,
Request: Send,
<T as TryStream>::Ok: Send,
impl<T, E, Request> Sync for Client<T, E, Request> where
Request: Send,
<T as TryStream>::Ok: Send,
Request: Send,
<T as TryStream>::Ok: Send,
impl<T, E, Request> Unpin for Client<T, E, Request>
impl<T, E, Request> !UnwindSafe for Client<T, E, Request>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<M, T, Target, Request> MakeTransport<Target, Request> for M where
M: Service<Target, Response = T>,
T: TryStream + Sink<Request>,
[src]
M: Service<Target, Response = T>,
T: TryStream + Sink<Request>,
type Item = <T as TryStream>::Ok
Items produced by the transport
type Error = <T as TryStream>::Error
Errors produced when receiving from the transport
type SinkError = <T as Sink<Request>>::Error
Errors produced when sending to the transport
type Transport = T
The Sink + Stream
implementation created by this factory
type MakeError = <M as Service<Target>>::Error
Errors produced while building a transport.
type Future = <M as Service<Target>>::Future
The future of the Service
instance.
fn poll_ready(
&mut Self,
&mut Context
) -> Poll<Result<(), <M as MakeTransport<Target, Request>>::MakeError>>
[src]
&mut Self,
&mut Context
) -> Poll<Result<(), <M as MakeTransport<Target, Request>>::MakeError>>
fn make_transport(
&mut Self,
Target
) -> <M as MakeTransport<Target, Request>>::Future
[src]
&mut Self,
Target
) -> <M as MakeTransport<Target, Request>>::Future
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,