Skip to main content

IntoResponse

Trait IntoResponse 

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

Anything a handler can return.

Required Methods§

Source

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

Source§

impl IntoResponse for ()

Source§

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.

Source§

impl IntoResponse for String

Source§

impl IntoResponse for Value

Source§

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

Source§

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

Source§

impl<T: IntoResponse> IntoResponse for Option<T>

Source§

fn into_response(self) -> Response

None becomes a 404 — the usual meaning of “the handler found nothing”.

Implementors§