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
37
#![allow(missing_docs)]
use std::fmt;
pub enum Error<M> {
FullBuffer(M),
Timeout,
UnexpectedFailure(Option<M>),
}
impl<M> fmt::Debug for Error<M> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::Timeout => write!(f, "Timeout"),
Error::FullBuffer(..) => write!(f, "FullBuffer(..)"),
Error::UnexpectedFailure(..) => write!(f, "UnexpectedFailure(..)"),
}
}
}
impl<M> fmt::Display for Error<M> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::Timeout => write!(f, "send timeout is exceeded"),
Error::FullBuffer(..) => write!(f, "appliance buffer is full"),
Error::UnexpectedFailure(..) => write!(f, "unexpected failure"),
}
}
}
impl<M> std::error::Error for Error<M> {}