#[non_exhaustive]pub enum DecodeError {
UnexpectedEof,
VarintTooLong,
InvalidWireType(u32),
InvalidFieldNumber,
MessageTooLarge,
WireTypeMismatch {
field_number: u32,
expected: u8,
actual: u8,
},
InvalidUtf8,
RecursionLimitExceeded,
InvalidEndGroup(u32),
InvalidMessageSet(&'static str),
}Expand description
An error that occurred while decoding a protobuf message.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnexpectedEof
The buffer ended before a complete value could be read.
VarintTooLong
A varint exceeded the maximum encoded length of 10 bytes.
InvalidWireType(u32)
The wire type in a tag was not a recognised protobuf wire type.
Carries the raw 3-bit value from the tag for diagnostic purposes.
InvalidFieldNumber
The field number decoded from a tag was zero, or the tag varint
overflowed a u32 — both indicate a malformed message.
MessageTooLarge
The message or sub-message length exceeded the configured size limit.
By default, the limit is 2 GiB. Use DecodeOptions::with_max_message_size
to set a lower limit for untrusted input.
WireTypeMismatch
The wire type of an incoming field did not match the type expected for that field number.
Carries the field number and the raw wire type values (as u8 to keep
this type independent of the encoding module).
InvalidUtf8
A string field contained bytes that are not valid UTF-8.
RecursionLimitExceeded
The message nesting depth exceeded the recursion limit.
InvalidEndGroup(u32)
An EndGroup tag was encountered with a field number that does not match the opening StartGroup tag, or an EndGroup was seen outside of a group.
InvalidMessageSet(&'static str)
A MessageSet Item group was malformed (missing or out-of-range
type_id). Only occurs for messages declared with
option message_set_wire_format = true.
Trait Implementations§
Source§impl Clone for DecodeError
impl Clone for DecodeError
Source§fn clone(&self) -> DecodeError
fn clone(&self) -> DecodeError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DecodeError
impl Debug for DecodeError
Source§impl Display for DecodeError
impl Display 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)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()