Skip to main content

OutgoingRequestExt

Trait OutgoingRequestExt 

Source
pub trait OutgoingRequestExt: OutgoingRequest {
    // Provided method
    fn try_into_http_request<T>(
        self,
        base_url: &str,
        authentication_input: <Self::Authentication as AuthScheme>::Input<'_>,
        path_builder_input: <Self::PathBuilder as PathBuilder>::Input<'_>,
    ) -> Result<Request<T>, IntoHttpError>
       where T: Default + BufMut + AsRef<[u8]> { ... }
}
Available on crate feature api only.
Expand description

Convenience functionality on top of OutgoingRequest.

Provided Methods§

Source

fn try_into_http_request<T>( self, base_url: &str, authentication_input: <Self::Authentication as AuthScheme>::Input<'_>, path_builder_input: <Self::PathBuilder as PathBuilder>::Input<'_>, ) -> Result<Request<T>, IntoHttpError>
where T: Default + BufMut + AsRef<[u8]>,

Tries to convert this request into an http::Request.

The endpoints path will be appended to the given base_url, for example https://matrix.org. Since all paths begin with a slash, it is not necessary for the base_url to have a trailing slash. If it has one however, it will be ignored.

§Errors

This method can return an error in the following cases:

  • On endpoints that require authentication, when adequate information isn’t provided through authentication_input, i.e. when AuthScheme::add_authentication() returns an error.
  • On endpoints that have several versions for the path, when there are no supported versions for the endpoint, i.e. when PathBuilder::make_endpoint_url() returns an error.
  • If the request serialization fails, which should only happen in case of bugs in Ruma.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§