从 0.4 开始,实现IntoResponse
不需要Body
和BodyError
。
0.2~0.3 版本
impl IntoResponse for AppError {
type Body = Full<Bytes>;
type BodyError = Infallible;
fn into_response(self) -> axum::http::Response<Self::Body> {
self.message.into_response()
}
}