conjure_runtime::raw

Trait Service

Source
pub trait Service<R> {
    type Response;
    type Error;

    // Required method
    fn call(
        &self,
        req: R,
    ) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send;
}
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.

Required Methods§

Source

fn call( &self, req: R, ) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send

Asynchronously perform the request.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

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

Source§

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

Source§

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

Source§

fn call(&self, req: R) -> impl Future<Output = Result<T::Response, T::Error>>

Implementors§