Trait under::IntoResponse
source · pub trait IntoResponse {
fn into_response(self) -> Result<Response, Error>;
}Expand description
Converts the current type into a crate::Response.
This assumes that the conversion into a response is fallible
(as it often is). This is used instead of TryFrom because
TryFrom<Result<T, E>> is not implemented for Result<T, E>.
This uses anyhow::Error as the error type for a few reasons:
anyhow::Errordoes not implementstd::error::Error.std::convert::Infallible/!does not implementInto<T>/From<T>.- I can’t figure out how to reconcile the two such that
IntoResponsecan be implemented forResult<R, E>whereR: IntoResponse; especially ifRisResponse, as theIntoResponseimplementation for that would have the error type beInfallible.