pub trait Service<R> {
    type Response;
    type Error;
    type Future: Future<Output = Result<Self::Response, Self::Error>>;

    // Required method
    fn call(&self, req: R) -> Self::Future;
}
Expand description

An asynchronous function from request to response.

This trait is based on the tower::Service trait, but differs in two ways. It does not have a poll_ready method as our client-side backpressure depends on the request, and the call method takes &self rather than &mut self as our client is designed to be used through a shared reference.

Required Associated Types§

source

type Response

The response type returned by the service.

source

type Error

The error type returned by the service.

source

type Future: Future<Output = Result<Self::Response, Self::Error>>

The future type returned by the service.

Required Methods§

source

fn call(&self, req: R) -> Self::Future

Asynchronously perform the request.

Implementations on Foreign Types§

source§

impl<R, T> Service<R> for Arc<T>where T: ?Sized + Service<R>,

§

type Response = <T as Service<R>>::Response

§

type Error = <T as Service<R>>::Error

§

type Future = <T as Service<R>>::Future

source§

fn call(&self, req: R) -> Self::Future

Implementors§