httlib_protos/encoder/
error.rs1use std::error;
2use std::fmt;
3use std::io;
4use std::convert;
5
6#[derive(Debug, PartialEq)]
9pub enum EncoderError {
10 DataOverflow,
12
13 Interrupted,
16
17 InvalidTag,
21}
22
23impl From<io::Error> for EncoderError {
24 fn from(_err: io::Error) -> Self {
25 Self::Interrupted
26 }
27}
28
29impl From<convert::Infallible> for EncoderError { fn from(_: convert::Infallible) -> Self {
31 unreachable!()
32 }
33}
34
35impl fmt::Display for EncoderError {
36 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
37 match self {
38 Self::DataOverflow => write!(fmt, "Available data type size exceeded."),
39 Self::Interrupted => write!(fmt, "Write operation interrupted."),
40 Self::InvalidTag => write!(fmt, "Found tag with invalid number."),
41 }
42 }
43}
44
45impl error::Error for EncoderError {}