pub trait FromHttpResponse {
// Required method
fn from_http_response(http_response: Response<Bytes>) -> Result<Self, Error>
where Self: Sized;
}Expand description
Trait for types that can be converted from http::Response
Required Methods§
Sourcefn from_http_response(http_response: Response<Bytes>) -> Result<Self, Error>where
Self: Sized,
fn from_http_response(http_response: Response<Bytes>) -> Result<Self, Error>where
Self: Sized,
Convert from http::Response to our Response
§Errors
The implementation of this trait will map the response to an error if it should be interpreted as such.
Typical HTTP status code errors are read by the default implementation of crate::HttpRequest::read_response
already, so in most cases additional checks are not necessary here.
Of course if the contents of the response cannot be parsed, this will usually be handled as an error as well.