Client

Trait Client 

Source
pub trait Client {
    type Error: Error;

    // Required method
    fn request<R: Request>(
        &self,
        request: R,
    ) -> BoxFuture<'_, Result<ApiResult<R::Response>, Self::Error>>;
}
Expand description

Abstraction over API clients.

Required Associated Types§

Source

type Error: Error

The error type produced by the client when an error occurs.

Required Methods§

Source

fn request<R: Request>( &self, request: R, ) -> BoxFuture<'_, Result<ApiResult<R::Response>, Self::Error>>

Dispatch an API request.

Takes Request and returns a future that waits for the Response.

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<C: Client + ?Sized> Client for &C

Source§

type Error = <C as Client>::Error

Source§

fn request<R: Request>( &self, request: R, ) -> BoxFuture<'_, Result<ApiResult<R::Response>, Self::Error>>

Source§

impl<C: Client + ?Sized> Client for &mut C

Source§

type Error = <C as Client>::Error

Source§

fn request<R: Request>( &self, request: R, ) -> BoxFuture<'_, Result<ApiResult<R::Response>, Self::Error>>

Source§

impl<C: Client + ?Sized> Client for Box<C>

Source§

type Error = <C as Client>::Error

Source§

fn request<R: Request>( &self, request: R, ) -> BoxFuture<'_, Result<ApiResult<R::Response>, Self::Error>>

Implementors§