Trait AsyncClient

Source
pub trait AsyncClient:
    Clone
    + Send
    + Sync
    + 'static {
    type Response: AsyncResponse + Send;

    // Required method
    fn request(
        &self,
        req: AsyncRequest,
    ) -> impl Future<Output = Result<Self::Response>> + Send;

    // Provided method
    fn describe(&self, f: &mut Formatter<'_>) -> Result { ... }
}
Available on crate feature async only.
Expand description

Trait for asynchronous HTTP clients.

Backend implementations must provide a concrete type that implements this trait to handle asynchronous HTTP requests.

Required Associated Types§

Source

type Response: AsyncResponse + Send

The type of response returned by this client.

Required Methods§

Source

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

Sends an HTTP request and returns a future that resolves to the response.

Provided Methods§

Source

fn describe(&self, f: &mut Formatter<'_>) -> Result

Provides a textual description of this client.

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§