pub enum DecodingError {
Stream(Error),
InvalidWireType {
semantic: &'static str,
wire: WireType,
},
ValueOutOfRange,
LengthPrefixOutOfRange,
InvalidPacket(Error),
PacketUnderRead {
declared: usize,
unread: usize,
},
InvalidBool(u8),
InvalidString(FromUtf8Error),
}Expand description
A decoding error.
Variants§
Stream(Error)
There was an error reading the stream.
InvalidWireType
The wire type was invalid for the value being decoded.
ValueOutOfRange
The value was out of range.
LengthPrefixOutOfRange
The length prefix was out of range.
InvalidPacket(Error)
There was an error decoding a packet.
PacketUnderRead
A length-prefixed packet’s body was shorter than the declared length prefix.
The declared field is the byte length the packet’s length prefix announced. The unread
field is the number of bytes left in the bounded reader after [Packet::decode_from_read]
returned. Indicates a buggy [Packet] implementation that under-read its body.
InvalidBool(u8)
The encoded boolean value was invalid. (must be 0 or 1)
InvalidString(FromUtf8Error)
The encoded string was invalid.
Implementations§
Source§impl DecodingError
Construction
impl DecodingError
Construction
Sourcepub fn from_var_int_error(error: Error) -> Self
pub fn from_var_int_error(error: Error) -> Self
Creates a decoding error from the var-int decoding error.
Sourcepub fn from_length_prefix_error(error: Error) -> Self
pub fn from_length_prefix_error(error: Error) -> Self
Creates a decoding error from the var-int length-prefix decoding error.
Sourcepub fn from_packet_error(error: Error) -> Self
pub fn from_packet_error(error: Error) -> Self
Creates a decoding error from the packet decoding error.
Trait Implementations§
Source§impl Debug for DecodingError
impl Debug for DecodingError
Source§impl Display for DecodingError
impl Display for DecodingError
Source§impl Error for DecodingError
impl Error for DecodingError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()