blob: 2daa450928d6d975a62ed5d43d1648c1c0a82d2d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
use std::fmt::{self, Display, Formatter};
#[derive(Debug)]
pub enum Error {
DataError(bincode::Error),
IoError(sys_util::Error),
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
use Error::*;
match self {
DataError(error) => write!(f, "{}", error),
IoError(error) => write!(f, "{}", error),
}
}
}
impl From<bincode::Error> for Error {
fn from(error: bincode::Error) -> Self {
Self::DataError(error)
}
}
impl From<sys_util::Error> for Error {
fn from(error: sys_util::Error) -> Self {
Self::IoError(error)
}
}
impl From<std::io::Error> for Error {
fn from(error: std::io::Error) -> Self {
Self::IoError(error.into())
}
}
|