http_error/
reason.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use std::fmt;

use crate::HttpError;

pub struct Reason<E>(pub E);

impl<E> fmt::Display for Reason<E>
where
    E: HttpError,
{
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        self.0.reason(f)
    }
}

impl fmt::Display for Reason<Box<dyn HttpError>> {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        self.0.reason(f)
    }
}

impl fmt::Display for Reason<Box<dyn HttpError + Send + 'static>> {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        self.0.reason(f)
    }
}