pub trait Response: Sized {
// Required method
fn try_from_http_response<T: AsRef<[u8]>>(
response: Response<T>,
) -> Result<Self, FromHttpError>;
}
Expand description
A trait for converting an HTTP response into a result of Self
.
Required Methods§
Sourcefn try_from_http_response<T: AsRef<[u8]>>(
response: Response<T>,
) -> Result<Self, FromHttpError>
fn try_from_http_response<T: AsRef<[u8]>>( response: Response<T>, ) -> Result<Self, FromHttpError>
Converts an HTTP response into a result of Self
, where Self
refers to the implementing type.
§Arguments
response
- The HTTP response to convert.
§Errors
Will error if the HTTP response is not a succeeding status code as determined by the type or if the response body cannot be deserialized into the implementing type.
See FromHttpError
for more details.
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.