Skip to main content

IntoResponse

Trait IntoResponse 

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

Trait for types that can be converted into a response.

Required Methods§

Source

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

Source§

impl IntoResponse for ()

Source§

impl IntoResponse for Infallible

Source§

impl IntoResponse for String

Source§

impl<T, E> IntoResponse for Result<T, E>

Implementors§

Source§

impl IntoResponse for ApiKeyError

Source§

impl IntoResponse for BasicAuthError

Source§

impl IntoResponse for BearerTokenError

Source§

impl IntoResponse for Binary

Source§

impl IntoResponse for CancelledError

Source§

impl IntoResponse for CookieExtractError

Source§

impl IntoResponse for DigestAuthError

Source§

impl IntoResponse for FileResponse

Source§

impl IntoResponse for FormExtractError

Source§

impl IntoResponse for HeaderExtractError

Source§

impl IntoResponse for Html

Source§

impl IntoResponse for HttpError

Source§

impl IntoResponse for JsonExtractError

Source§

impl IntoResponse for MultipartExtractError

Source§

impl IntoResponse for NoContent

Source§

impl IntoResponse for OAuth2BearerError

Source§

impl IntoResponse for PathExtractError

Source§

impl IntoResponse for QueryExtractError

Source§

impl IntoResponse for Redirect

Source§

impl IntoResponse for Response

Source§

impl IntoResponse for ResponseValidationError

Source§

impl IntoResponse for StateExtractError

Source§

impl IntoResponse for Text

Source§

impl IntoResponse for ValidationErrors

Source§

impl<E> IntoResponse for ValidExtractError<E>
where E: IntoResponse,

Source§

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.

Source§

impl<T> IntoResponse for ValidatedResponse<T>
where T: Serialize + ResponseModel,