Struct tokio_tower::pipeline::client::Client[][src]

pub struct Client<T, E, Request> where
    T: Sink<Request> + TryStream
{ /* fields omitted */ }

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.

Implementations

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]

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]

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]

impl<T, E, Request> Load for Client<T, E, Request> where
    T: Sink<Request> + TryStream
[src]

type Metric = usize

A comparable load metric. Read more

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]

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.

Auto Trait Implementations

impl<T, E, Request> !RefUnwindSafe for Client<T, E, Request>[src]

impl<T, E, Request> Send for Client<T, E, Request> where
    Request: Send,
    <T as TryStream>::Ok: Send
[src]

impl<T, E, Request> Sync for Client<T, E, Request> where
    Request: Send,
    <T as TryStream>::Ok: Send
[src]

impl<T, E, Request> Unpin for Client<T, E, Request>[src]

impl<T, E, Request> !UnwindSafe for Client<T, E, Request>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<M, T, Target, Request> MakeTransport<Target, Request> for M where
    M: Service<Target, Response = T>,
    T: TryStream + Sink<Request>, 
[src]

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.

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.