pub trait IntoResponse {
// Required method
fn into_response(self) -> Response;
}Expand description
Conversion of handler return values into HTTP responses.
Required Methods§
fn into_response(self) -> Response
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
impl IntoResponse for &'static str
fn into_response(self) -> Response
Source§impl IntoResponse for StatusCode
impl IntoResponse for StatusCode
fn into_response(self) -> Response
Source§impl IntoResponse for String
impl IntoResponse for String
fn into_response(self) -> Response
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.
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.