Trait RequestHttpConvert

Source
pub trait RequestHttpConvert<Request> {
    // Required methods
    fn from_http_request<'async_trait>(
        request: Request<Body>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Request>, ProtocolError>> + Send + 'async_trait>>;
    fn to_http_request(
        &self,
        base_url: &Uri,
    ) -> Result<Option<Request<Body>>, ProtocolError>;
}
Expand description

A request that can convert to and from a HttpRequest<Body>.

Required Methods§

Source

fn from_http_request<'async_trait>( request: Request<Body>, ) -> Pin<Box<dyn Future<Output = Result<Option<Request>, ProtocolError>> + Send + 'async_trait>>

Deserializes a HttpRequest<Body> into Request. Returns a protocol error if the request conversion fails (i.e. request validation fails, unexpected error, etc.). Returns None if the request type is unknown or unsupported for remote host scenarios, which is synonymous with a “not found” error.

Source

fn to_http_request( &self, base_url: &Uri, ) -> Result<Option<Request<Body>>, ProtocolError>

Serializes a Request into a HttpRequest<Body>. Returns None if the request is unsupported for this protocol, which is synonymous with a “not found” error.

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.

Implementors§