blob: 488ae0d658a1b16725d57894e0495fb1a39ffdb5 (
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
27
28
|
#[derive(Debug)]
pub enum ErrorKind {
WrongMsgType,
BoolOutOfRange,
UnknownVariant,
WrongVariant,
IOError(std::io::Error),
TryFromIntError(std::num::TryFromIntError),
Utf8Error(std::string::FromUtf8Error),
}
impl std::convert::From<std::io::Error> for ErrorKind {
fn from(error: std::io::Error) -> Self {
ErrorKind::IOError(error)
}
}
impl std::convert::From<std::num::TryFromIntError> for ErrorKind {
fn from(error: std::num::TryFromIntError) -> Self {
ErrorKind::TryFromIntError(error)
}
}
impl std::convert::From<std::string::FromUtf8Error> for ErrorKind {
fn from(error: std::string::FromUtf8Error) -> Self {
ErrorKind::Utf8Error(error)
}
}
|