pub trait Client {
type BodyWriter;
type ResponseBody: Iterator<Item = Result<Bytes, Error>>;
// Required method
fn send(
&self,
req: Request<RequestBody<'_, Self::BodyWriter>>,
) -> Result<Response<Self::ResponseBody>, Error>;
}Expand description
A trait implemented by HTTP client implementations.
Required Associated Types§
Sourcetype BodyWriter
type BodyWriter
The client’s binary request write type.
Required Methods§
Sourcefn send(
&self,
req: Request<RequestBody<'_, Self::BodyWriter>>,
) -> Result<Response<Self::ResponseBody>, Error>
fn send( &self, req: Request<RequestBody<'_, Self::BodyWriter>>, ) -> Result<Response<Self::ResponseBody>, Error>
Makes an HTTP request.
The request’s URI will be in absolute-form and it will always contain an Endpoint object in its extensions.
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 dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".