use std::fmt;
use std::path::PathBuf;
#[derive(Debug)]
pub enum Error {
Io {
path: PathBuf,
source: std::io::Error,
},
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::Io { path, source } => {
write!(f, "{}: {}", path.display(), source)
}
}
}
}
impl std::error::Error for Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Error::Io { source, .. } => Some(source),
}
}
}