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