Trait AsyncClient

Source
pub trait AsyncClient {
    type BodyWriter;
    type ResponseBody: Stream<Item = Result<Bytes, Error>>;

    // Required method
    fn send(
        &self,
        req: Request<AsyncRequestBody<'_, Self::BodyWriter>>,
    ) -> impl Future<Output = Result<Response<Self::ResponseBody>, Error>> + Send;
}
Expand description

A trait implemented by async HTTP client implementations.

Required Associated Types§

Source

type BodyWriter

The client’s binary request body write type.

Source

type ResponseBody: Stream<Item = Result<Bytes, Error>>

The client’s binary response body type.

Required Methods§

Source

fn send( &self, req: Request<AsyncRequestBody<'_, Self::BodyWriter>>, ) -> impl Future<Output = Result<Response<Self::ResponseBody>, Error>> + Send

Makes an HTTP request.

The client is responsible for assembling the request URI. It is provided with the path template, unencoded path parameters, unencoded query parameters, header parameters, and request body.

A response must only be returned if it has a 2xx status code. The client is responsible for handling all other status codes (for example, converting a 5xx response into a service error). The client is also responsible for decoding the response body if necessary.

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§