1use std::{io, result};
2
3#[derive(Debug)]
4pub enum Error {
5 IoError(io::Error),
6 Timeout,
7 Parse,
8}
9
10impl From<Error> for io::Error {
11 fn from(val: Error) -> Self {
12 match val {
13 Error::IoError(e) => e,
14 Error::Timeout => io::Error::new(io::ErrorKind::Other, "devd poll timeout"),
15 Error::Parse => io::Error::new(io::ErrorKind::Other, "devd parse error"),
16 }
17 }
18}
19
20impl From<io::Error> for Error {
21 fn from(err: io::Error) -> Error {
22 Error::IoError(err)
23 }
24}
25
26pub type Result<T> = result::Result<T, Error>;