1pub type Result<T = ()> = std::result::Result<T, Error>;
2
3#[derive(Debug)]
4pub enum Error {
5 Io(std::io::Error),
6 InvalidId,
7}
8
9impl std::error::Error for Error {}
10
11impl std::fmt::Display for Error {
12 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13 let s = match self {
14 Self::InvalidId => "Invalid id".to_string(),
15 Self::Io(err) => format!("{}", err),
16 };
17
18 write!(f, "{s}")
19 }
20}
21
22impl From<std::io::Error> for Error {
23 fn from(err: std::io::Error) -> Self {
24 Self::Io(err)
25 }
26}