ruma::client::http_client

Trait HttpClient

Source
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§

Source

type RequestBody: Default + BufMut + Send

The type to use for try_into_http_request.

Source

type ResponseBody: AsRef<[u8]>

The type to use for try_from_http_response.

Source

type Error: Send + Unpin

The error type for the send_request function.

Required Methods§

Source

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.

Implementations on Foreign Types§

Source§

impl HttpClient for Client

Source§

impl<C> HttpClient for Client<C, Full<Bytes>>
where C: Connect + Clone + Send + Sync + 'static,

Implementors§