Skip to main content

Client

Trait Client 

Source
pub trait Client {
    // Required method
    fn execute(
        &self,
        request: Request,
    ) -> impl Future<Output = Result<Response, Error>> + '_;
}
Expand description

A generic client.

This is needed by RequestBuilder to be generic over the specific implementation of a client. Its only requirement is to be able to execute reqwest::Requests.

This is implemented for reqwest::Client and reqwest_middleware::ClientWithMiddleware (with middleware feature). It provides a single interface for executing a reqwest::Request.

Required Methods§

Source

fn execute( &self, request: Request, ) -> impl Future<Output = Result<Response, Error>> + '_

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 Client for ClientWithMiddleware

Available on crate feature middleware only.
Source§

async fn execute(&self, request: Request) -> Result<Response, Error>

Source§

impl Client for Client

Source§

async fn execute(&self, request: Request) -> Result<Response, Error>

Implementors§