rustify::client

Trait Client

source
pub trait Client: Sync + Send {
    // Required methods
    fn send<'life0, 'async_trait>(
        &'life0 self,
        req: Request<Vec<u8>>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Vec<u8>>, ClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn base(&self) -> &str;

    // Provided method
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        req: Request<Vec<u8>>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Vec<u8>>, ClientError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Represents an HTTP client which is capable of executing Endpoints by sending the Request generated by the Endpoint and returning a Response.

Required Methods§

source

fn send<'life0, 'async_trait>( &'life0 self, req: Request<Vec<u8>>, ) -> Pin<Box<dyn Future<Output = Result<Response<Vec<u8>>, ClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sends the given Request and returns a Response. Implementations should consolidate all errors into the ClientError type.

source

fn base(&self) -> &str

Returns the base URL the client is configured with. This is used for creating the fully qualified URLs used when executing Endpoints.

Provided Methods§

source

fn execute<'life0, 'async_trait>( &'life0 self, req: Request<Vec<u8>>, ) -> Pin<Box<dyn Future<Output = Result<Response<Vec<u8>>, ClientError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

This method provides a common interface to Endpoints for execution.

Implementors§