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 super::fmt_provider as fmt;
#[derive(Debug)]
pub struct ParityError {
expected: u8,
actual: u8,
}
impl ParityError {
pub(crate) fn new(expected: u8, actual: u8) -> Self {
ParityError {
expected,
actual,
}
}
}
impl fmt::Display for ParityError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "incorrect parity: expected {}, actual {}", self.expected, self.actual)
}
}
#[cfg(feature = "std")]
mod std_impls {
use std::error::Error;
use super::ParityError;
impl Error for ParityError {
}
}