Skip to main content

IntoResponse

Trait IntoResponse 

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

Implemented by any type that can be turned into an HTTP Response.

Implement this on your application error enum so handlers can return Result<Response, MyError> and the framework maps the error to the correct HTTP status automatically.

Response itself implements IntoResponse as the identity conversion.

Required Methods§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§