Skip to main content

IntoResponse

Trait IntoResponse 

Source
pub trait IntoResponse {
    // Required method
    fn into_response(self) -> Response;
}
Expand description

Conversion of handler return values into HTTP responses.

Required Methods§

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl IntoResponse for &'static str

Source§

impl IntoResponse for StatusCode

Source§

impl IntoResponse for String

Source§

impl<T: IntoResponse> IntoResponse for (StatusCode, T)

Render the inner value, then overwrite the status. This is what makes (StatusCode::ACCEPTED, Json(body)) a 202-with-JSON and (StatusCode::ACCEPTED, "queued") a 202 text response — the body’s own content type and bytes are kept, only the status line changes.

Implementors§