1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-07-01 16:55:08 +02:00

add associated error type to MessageBody (#2183)

This commit is contained in:
Rob Ede
2021-05-05 18:36:02 +01:00
committed by GitHub
parent dd1a3e7675
commit ddaf8c3e43
27 changed files with 447 additions and 74 deletions

View File

@ -2,6 +2,7 @@
use std::{
cell::RefCell,
error::Error as StdError,
fmt,
io::{self, Write as _},
str::Utf8Error,
@ -105,8 +106,7 @@ impl From<()> for Error {
impl From<std::convert::Infallible> for Error {
fn from(_: std::convert::Infallible) -> Self {
// `std::convert::Infallible` indicates an error
// that will never happen
// hint that an error that will never happen
unreachable!()
}
}
@ -145,6 +145,8 @@ impl From<ResponseBuilder> for Error {
#[display(fmt = "Unknown Error")]
struct UnitError;
impl ResponseError for Box<dyn StdError + 'static> {}
/// Returns [`StatusCode::INTERNAL_SERVER_ERROR`] for [`UnitError`].
impl ResponseError for UnitError {}