pub trait IntoResponse {
// Required method
fn into_response(self) -> Response;
}Expand description
Trait for types that can be converted into a response.
Required Methods§
Sourcefn into_response(self) -> Response
fn into_response(self) -> Response
Convert into a 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 Infallible
impl IntoResponse for Infallible
fn into_response(self) -> Response
Source§impl IntoResponse for String
impl IntoResponse for String
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
Implementors§
impl IntoResponse for ApiKeyError
impl IntoResponse for BasicAuthError
impl IntoResponse for BearerTokenError
impl IntoResponse for Binary
impl IntoResponse for CancelledError
impl IntoResponse for CookieExtractError
impl IntoResponse for DigestAuthError
impl IntoResponse for FileResponse
impl IntoResponse for FormExtractError
impl IntoResponse for HeaderExtractError
impl IntoResponse for Html
impl IntoResponse for HttpError
impl IntoResponse for JsonExtractError
impl IntoResponse for MultipartExtractError
impl IntoResponse for NoContent
impl IntoResponse for OAuth2BearerError
impl IntoResponse for PathExtractError
impl IntoResponse for QueryExtractError
impl IntoResponse for Redirect
impl IntoResponse for Response
impl IntoResponse for ResponseValidationError
impl IntoResponse for StateExtractError
impl IntoResponse for Text
impl IntoResponse for ValidationErrors
impl<E> IntoResponse for ValidExtractError<E>where
E: IntoResponse,
impl<T> IntoResponse for Json<T>where
T: Serialize,
Json<T> doubles as a response type, mirroring FastAPI returning a model:
200 OK with an application/json body. A serialization failure is a
server bug, so it maps to a 500 via crate::error::HttpError::internal
rather than panicking inside a handler.