Skip to main content

IntoHttpResponse

Trait IntoHttpResponse 

Source
pub trait IntoHttpResponse {
    // Required method
    fn into_http_response(self) -> HttpResponse;

    // Provided method
    fn into_wrapped_http_response<E>(self) -> Result<HttpResponse, E>
       where Self: Sized { ... }
}
Expand description

Trait for converting a ClientResponse into a HttpResponse.

You can implement this trait on your types, of course, but its main goal is to enable ClientResponse as return value in impl Responder contexts.

Required Methods§

Source

fn into_http_response(self) -> HttpResponse

Creates a HttpResponse from self.

Provided Methods§

Source

fn into_wrapped_http_response<E>(self) -> Result<HttpResponse, E>
where Self: Sized,

Wraps the HttpResponse created by into_http_response in a Result.

§Errors

Because into_http_response is infallible, this method is, too. So calling this method never fails and never returns an Err.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl IntoHttpResponse for ClientResponse<Decompress<Payload>>

Implementors§