msgpacker/error.rs
1use core::fmt;
2
3/// Deserialization errors for the protocol implementation.
4#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
5pub enum Error {
6 /// The provided buffer is too short and yielded an unexpected EOF.
7 BufferTooShort,
8 /// The enum variant is not valid for the static type.
9 InvalidEnumVariant,
10 /// The extension is not in accordance to the protocol definition.
11 InvalidExtension,
12 /// The string is not a valid UTF-8.
13 InvalidUtf8,
14 /// The protocol format tag is not valid.
15 UnexpectedFormatTag,
16 /// The provided bin length is not valid.
17 UnexpectedBinLength,
18 /// Not yet implemented.
19 NotImplemented,
20}
21
22impl fmt::Display for Error {
23 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24 fmt::Debug::fmt(self, f)
25 }
26}
27
28impl core::error::Error for Error {}