Trait ruma::client::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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl HttpClient for Client

§

type RequestBody = BytesMut

§

type ResponseBody = Bytes

§

type Error = Error

source§

async fn send_http_request( &self, req: Request<BytesMut> ) -> Result<Response<Bytes>, Error>

source§

impl HttpClient for HttpClient

§

type RequestBody = Vec<u8>

§

type ResponseBody = Vec<u8>

§

type Error = Error

source§

async fn send_http_request( &self, req: Request<Vec<u8>> ) -> Result<Response<Vec<u8>>, Error>

source§

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

§

type RequestBody = BytesMut

§

type ResponseBody = Bytes

§

type Error = Error

source§

async fn send_http_request( &self, req: Request<BytesMut> ) -> Result<Response<Bytes>, Error>

Implementors§