Enum bincode::error::DecodeError [−][src]
#[non_exhaustive]
pub enum DecodeError {
Show 15 variants
UnexpectedEnd,
LimitExceeded,
InvalidIntegerType {
expected: IntegerType,
found: IntegerType,
},
NonZeroTypeIsZero {
non_zero_type: IntegerType,
},
UnexpectedVariant {
type_name: &'static str,
allowed: AllowedEnumVariants,
found: u32,
},
Utf8(Utf8Error),
InvalidCharEncoding([u8; 4]),
InvalidBooleanValue(u8),
ArrayLengthMismatch {
required: usize,
found: usize,
},
CStrNulError {
inner: FromBytesWithNulError,
},
OtherString(String),
SerdeAnyNotSupported,
SerdeIdentifierNotSupported,
SerdeIgnoredAnyNotSupported,
CannotBorrowOwnedData,
}Expand description
Errors that can be encounted by decoding a type
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
UnexpectedEnd
The reader reached its end but more bytes were expected.
LimitExceeded
The given configuration limit was exceeded
InvalidIntegerType
Fields
expected: IntegerTypeThe type that was being read from the reader
found: IntegerTypeThe type that was encoded in the data
Invalid type was found. The decoder tried to read type expected, but found type found instead.
NonZeroTypeIsZero
Fields
non_zero_type: IntegerTypeThe type that was being read from the reader
The decoder tried to decode any of the NonZero* types but the value is zero
UnexpectedVariant
Fields
type_name: &'static strThe type name that was being decoded.
allowed: AllowedEnumVariantsThe variants that are allowed
found: u32The index of the enum that the decoder encountered
Invalid enum variant was found. The decoder tried to decode variant index found, but the variant index should be between min and max.
Utf8(Utf8Error)
Tuple Fields
0: Utf8ErrorThe decoder tried to decode a str, but an utf8 error was encountered.
InvalidCharEncoding([u8; 4])
The decoder tried to decode a char and failed. The given buffer contains the bytes that are read at the moment of failure.
InvalidBooleanValue(u8)
Tuple Fields
0: u8The decoder tried to decode a bool and failed. The given value is what is actually read.
ArrayLengthMismatch
Fields
required: usizeThe length of the array required by the rust type.
found: usizeThe length of the array found in the binary format.
The decoder tried to decode an array of length required, but the binary data contained an array of length found.
CStrNulError
Fields
inner: FromBytesWithNulErrorThe inner exception
The decoder tried to decode a CStr or CString, but the incoming data contained a 0 byte
OtherString(String)
Tuple Fields
0: StringAn uncommon error occured, see the inner text for more information
SerdeAnyNotSupported
Bincode does not support serde’s any decoding feature
SerdeIdentifierNotSupported
Bincode does not support serde identifiers
SerdeIgnoredAnyNotSupported
Bincode does not support serde’s ignored_any
CannotBorrowOwnedData
Serde tried decoding a borrowed value from an owned reader. Use serde_decode_borrowed_from_* instead
Trait Implementations
Raised when there is general error when deserializing a type. Read more
Raised when a Deserialize receives a type different from what it was
expecting. Read more
Raised when a Deserialize receives a value of the right type but that
is wrong for some other reason. Read more
Raised when deserializing a sequence or map and the input data contains too many or too few elements. Read more
Raised when a Deserialize enum type received a variant with an
unrecognized name. Read more
Raised when a Deserialize struct type received a field with an
unrecognized name. Read more
Raised when a Deserialize struct type expected to receive a required
field with a particular name but that field was not present in the
input. Read more
Raised when a Deserialize struct type received more than one of the
same field. Read more
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
