blob: 2b47b8012cec13e3d8da97f21b92ec16fea589cd (
plain)
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
|
use std::{io, result};
#[derive(Debug)]
pub enum Error {
IoError(io::Error),
Timeout,
Parse,
}
impl From<Error> for io::Error {
fn from(val: Error) -> Self {
match val {
Error::IoError(e) => e,
Error::Timeout => io::Error::new(io::ErrorKind::Other, "devd poll timeout"),
Error::Parse => io::Error::new(io::ErrorKind::Other, "devd parse error"),
}
}
}
impl From<io::Error> for Error {
fn from(err: io::Error) -> Error {
Error::IoError(err)
}
}
pub type Result<T> = result::Result<T, Error>;
|