pub enum DecodeError {
    BufferLength {
        for_type: &'static str,
        expected: usize,
        given: usize,
    },
    InvalidLen {
        expected: usize,
        given: usize,
    },
    InvalidTag {
        tag: u8,
        sum_name: Option<String>,
    },
    InvalidUtf8,
    InvalidBool(u8),
    Other(String),
}Expand description
An error that occurred when decoding.
Variants§
BufferLength
Not enough data was provided in the input.
InvalidLen
Length did not match the statically expected length.
InvalidTag
The tag does not exist for the sum.
InvalidUtf8
Expected data to be UTF-8 but it wasn’t.
InvalidBool(u8)
Expected the byte to be 0 or 1 to be a valid bool.
Other(String)
Custom error not in the other variants of DecodeError.
Trait Implementations§
Source§impl Clone for DecodeError
 
impl Clone for DecodeError
Source§fn clone(&self) -> DecodeError
 
fn clone(&self) -> DecodeError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
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
Source§fn custom(msg: impl Display) -> DecodeError
 
fn custom(msg: impl Display) -> DecodeError
Raised when there is general error when deserializing a type.
Source§fn unknown_variant_tag<'de, T>(tag: u8, expected: &T) -> DecodeErrorwhere
    T: SumVisitor<'de>,
 
fn unknown_variant_tag<'de, T>(tag: u8, expected: &T) -> DecodeErrorwhere
    T: SumVisitor<'de>,
The 
tag does not specify a variant of the sum type.Source§fn named_products_not_supported() -> Self
 
fn named_products_not_supported() -> Self
Deserializing named products are not supported for this visitor.
Source§fn invalid_product_length<'de, T>(len: usize, expected: &T) -> Selfwhere
    T: ProductVisitor<'de>,
 
fn invalid_product_length<'de, T>(len: usize, expected: &T) -> Selfwhere
    T: ProductVisitor<'de>,
The product length was not as promised.
Source§fn missing_field<'de, T>(
    index: usize,
    field_name: Option<&str>,
    prod: &T,
) -> Selfwhere
    T: ProductVisitor<'de>,
 
fn missing_field<'de, T>(
    index: usize,
    field_name: Option<&str>,
    prod: &T,
) -> Selfwhere
    T: ProductVisitor<'de>,
There was a missing field at 
index.Source§fn duplicate_field<'de, T>(
    index: usize,
    field_name: Option<&str>,
    prod: &T,
) -> Selfwhere
    T: ProductVisitor<'de>,
 
fn duplicate_field<'de, T>(
    index: usize,
    field_name: Option<&str>,
    prod: &T,
) -> Selfwhere
    T: ProductVisitor<'de>,
A field with 
index was specified more than once.Source§fn unknown_field_name<'de, T>(field_name: &str, expected: &T) -> Selfwhere
    T: FieldNameVisitor<'de>,
 
fn unknown_field_name<'de, T>(field_name: &str, expected: &T) -> Selfwhere
    T: FieldNameVisitor<'de>,
A field with name 
field_name does not exist.Source§fn unknown_variant_name<'de, T>(name: &str, expected: &T) -> Selfwhere
    T: VariantVisitor<'de>,
 
fn unknown_variant_name<'de, T>(name: &str, expected: &T) -> Selfwhere
    T: VariantVisitor<'de>,
The 
name is not that of a variant of the sum type.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<Utf8Error> for DecodeError
 
impl From<Utf8Error> for DecodeError
Source§fn from(_: Utf8Error) -> DecodeError
 
fn from(_: Utf8Error) -> DecodeError
Converts to this type from the input type.
Source§impl Ord for DecodeError
 
impl Ord for DecodeError
Source§fn cmp(&self, other: &DecodeError) -> Ordering
 
fn cmp(&self, other: &DecodeError) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
    Self: Sized,
 
fn max(self, other: Self) -> Selfwhere
    Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for DecodeError
 
impl PartialEq for DecodeError
Source§impl PartialOrd for DecodeError
 
impl PartialOrd for DecodeError
impl Eq for DecodeError
impl StructuralPartialEq for DecodeError
Auto Trait Implementations§
impl Freeze for DecodeError
impl RefUnwindSafe for DecodeError
impl Send for DecodeError
impl Sync for DecodeError
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts 
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more