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
36
use std::{error, fmt};
use Error::DecodeError;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum Error {
DecodeError,
}
impl error::Error for Error {}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
DecodeError => f.write_str("decode error"),
}
}
}
macro_rules! impl_from_error {
($t:ty => $m:ident) => {
#[doc(hidden)]
impl From<$t> for Error {
fn from(_: $t) -> Self {
$m
}
}
};
}
impl_from_error!(base_x::DecodeError => DecodeError);