#[non_exhaustive]pub enum DecodeError {
UnexpectedEof {
needed: usize,
},
VarIntTooLong,
NegativeLength(i64),
LengthTooLarge {
len: usize,
limit: usize,
},
InvalidUtf8,
InvalidNbtTag(u8),
NbtTooDeep(usize),
NbtEndList,
Invalid(&'static str),
TrailingBytes(usize),
UnknownPacketId(i32),
IdMismatch {
expected: i32,
actual: i32,
},
}Expand description
Failure while decoding a value from bytes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
UnexpectedEof
The input ended before the value was complete.
VarIntTooLong
A VarInt was longer than 5 bytes (or a VarLong longer than 10).
NegativeLength(i64)
A length prefix was negative.
LengthTooLarge
A length prefix was larger than the remaining input or a configured limit.
InvalidUtf8
A string was not valid UTF-8 (or NBT Modified UTF-8).
InvalidNbtTag(u8)
An NBT tag id was not a known tag type.
NbtTooDeep(usize)
NBT nested deeper than the allowed limit.
NbtEndList
An NBT list declared elements of type End with a non-zero length.
Invalid(&'static str)
A value that is not allowed by the format (e.g. an empty top-bit-terminated array).
TrailingBytes(usize)
Bytes were left over after a packet body was decoded.
UnknownPacketId(i32)
The packet id is not known for this state/direction/version.
IdMismatch
A typed decode was requested for a packet with a different id.
Trait Implementations§
Source§impl Clone for DecodeError
impl Clone for DecodeError
Source§impl Debug for DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display for DecodeError
impl Eq for DecodeError
Source§impl Error for DecodeError
impl Error for DecodeError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<DecodeError> for FrameError
impl From<DecodeError> for FrameError
Source§fn from(source: DecodeError) -> Self
fn from(source: DecodeError) -> Self
Converts to this type from the input type.
Source§impl PartialEq for DecodeError
impl PartialEq for DecodeError
impl StructuralPartialEq for DecodeError
Auto Trait Implementations§
impl Forget for DecodeError
impl Freeze for DecodeError
impl RefUnwindSafe for DecodeError
impl Send for DecodeError
impl Sync for DecodeError
impl Unpin for DecodeError
impl UnsafeUnpin for DecodeError
impl UnwindSafe for DecodeError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more