pixiv_api/errors/
display.rs

1use super::*;
2
3impl Error for PixivError {}
4
5
6impl Debug for PixivError {
7    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
8        Debug::fmt(&self.kind, f)
9    }
10}
11
12impl Display for PixivError {
13    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
14        Display::fmt(&self.kind, f)
15    }
16}
17
18
19impl Display for ExampleErrorKind {
20    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
21        match self {
22            Self::UnknownError => { write!(f, "UnknownError") }
23            Self::RequestError { message, context } => {
24                write!(f, "RequestError: {}\n    at: {}", message, context)
25            }
26            Self::IoError { message, file } => {
27                write!(f, "IoError: {}\n    at: {}", message, file.display())
28            }
29        }
30    }
31}