pub trait IntoResponse {
// Required method
fn into_response(self) -> Response;
}Expand description
Anything a handler can return.
Required Methods§
Sourcefn into_response(self) -> Response
fn into_response(self) -> Response
Build the 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 ()
impl IntoResponse for ()
fn into_response(self) -> Response
Source§impl IntoResponse for Error
Renders a framework error as JSON.
impl IntoResponse for Error
Renders a framework error as JSON.
The default, and what an API client should get. The HTTP kernel wraps it
with content negotiation — an HTML error page for a browser — using the
RenderedError this attaches.
fn into_response(self) -> Response
Source§impl IntoResponse for String
impl IntoResponse for String
fn into_response(self) -> Response
Source§impl IntoResponse for Value
impl IntoResponse for Value
fn into_response(self) -> Response
Source§impl<T, E> IntoResponse for Result<T, E>where
T: IntoResponse,
E: IntoResponse,
impl<T, E> IntoResponse for Result<T, E>where
T: IntoResponse,
E: IntoResponse,
fn into_response(self) -> Response
Source§impl<T: IntoResponse> IntoResponse for (StatusCode, T)
impl<T: IntoResponse> IntoResponse for (StatusCode, T)
fn into_response(self) -> Response
Source§impl<T: IntoResponse> IntoResponse for Option<T>
impl<T: IntoResponse> IntoResponse for Option<T>
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
None becomes a 404 — the usual meaning of “the handler found
nothing”.