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
27
use core::fmt;
#[non_exhaustive]
#[derive(Debug, Clone)]
pub enum Error<W> {
Write(W)
}
impl<W: fmt::Display> fmt::Display for Error<W> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
Error::Write(e) => write!(f, "write error: {}", e),
}
}
}
#[cfg(feature = "std")]
impl<W: std::error::Error + 'static> std::error::Error for Error<W> {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Error::Write(e) => Some(e)
}
}
}