1use std::fmt;
2
3pub type Result<T> = std::result::Result<T, Error>;
5
6#[derive(Debug)]
8pub enum Error {
9 Io(std::io::Error),
11}
12
13impl fmt::Display for Error {
14 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15 match self {
16 Error::Io(err) => write!(f, "IO error: {}", err),
17 }
18 }
19}
20
21impl std::error::Error for Error {
22 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
23 match self {
24 Error::Io(err) => Some(err),
25 }
26 }
27}
28
29impl From<std::io::Error> for Error {
30 fn from(err: std::io::Error) -> Self {
31 Error::Io(err)
32 }
33}