Skip to main content

Client

Trait Client 

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

§HTTP Client Trait

This crate does not define a specific HTTP client implementation. Instead, it defines a trait Client that can be implemented for any client that is needed, such as reqwest, hyper, or others.

Currently, the only implementation provided is for reqwest. You’ll need to enable the reqwest feature in your Cargo.toml for it.

Also, the Client trait is designed to be mockable for testing purposes. If you enable the mock feature, it will provide a mockall implementation that can be used in tests.

Required Methods§

Source

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

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.

Implementors§