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
use core::fmt::Display;
#[allow(missing_docs)]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
pub enum ErrorKind {
SerializationError,
DeserializationError,
EncryptionError,
DecryptionError,
}
impl Display for ErrorKind {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let s = match self {
ErrorKind::SerializationError => "SerializationError: Failed to serialize data to send",
ErrorKind::DeserializationError => {
"DeserializationError: Failed to deserialize data received"
}
ErrorKind::EncryptionError => {
"EncryptionError: Failed to encrypt serialized data to send"
}
ErrorKind::DecryptionError => "DecryptionError: Failed to decrypt data received",
};
write!(f, "{}", s)
}
}