pub trait HttpClient: Sync {
type RequestBody: Default + BufMut + Send;
type ResponseBody: AsRef<[u8]>;
type Error: Send + Unpin;
// Required method
fn send_http_request(
&self,
req: Request<Self::RequestBody>,
) -> impl Future<Output = Result<Response<Self::ResponseBody>, Self::Error>> + Send;
}
Available on crate feature
client
only.Expand description
An HTTP client that can be used to send requests to a Matrix homeserver.
Required Associated Types§
Sourcetype RequestBody: Default + BufMut + Send
type RequestBody: Default + BufMut + Send
The type to use for try_into_http_request
.
Sourcetype ResponseBody: AsRef<[u8]>
type ResponseBody: AsRef<[u8]>
The type to use for try_from_http_response
.
Required Methods§
Sourcefn send_http_request(
&self,
req: Request<Self::RequestBody>,
) -> impl Future<Output = Result<Response<Self::ResponseBody>, Self::Error>> + Send
fn send_http_request( &self, req: Request<Self::RequestBody>, ) -> impl Future<Output = Result<Response<Self::ResponseBody>, Self::Error>> + Send
Send an http::Request
to get back an http::Response
.
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.