#[derive(Debug)]
pub enum Error {
Io(std::io::Error),
Nix(nix::errno::Errno),
Start,
}
impl std::error::Error for Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Error::Io(e) => Some(e),
_ => None,
}
}
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self)
}
}
impl From<std::io::Error> for Error {
fn from(e: std::io::Error) -> Self {
Error::Io(e)
}
}
impl From<nix::errno::Errno> for Error {
fn from(value: nix::errno::Errno) -> Self {
Error::Nix(value)
}
}