#[non_exhaustive]pub enum Error {
Show 28 variants
UnexpectedEof,
InvalidEscapeSequence,
StringControlChar,
ExpectedColon,
ExpectedArrayCommaOrEnd,
ExpectedArrayEnd,
LeadingArrayComma,
TrailingArrayComma,
ExpectedObjectCommaOrEnd,
ExpectedObjectEnd,
LeadingObjectComma,
TrailingObjectComma,
ExpectedToken,
ExpectedNull,
ExpectedString,
ExpectedArray,
ExpectedObject,
ExpectedStruct,
ExpectedEnumValue,
ExpectedEnumObjectEnd,
InvalidNumber,
InvalidType,
InvalidUnicodeCodePoint,
KeyMustBeAString,
TrailingCharacters,
UnexpectedChar,
InvalidLength,
DeserializeError(String),
}Expand description
Deserialization error
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnexpectedEof
EOF while parsing
InvalidEscapeSequence
Invalid JSON string escape sequence
StringControlChar
A control ASCII character detected in a JSON input
ExpectedColon
Expected this character to be a ':'.
ExpectedArrayCommaOrEnd
Expected this character to be either a ',' or a ']'.
ExpectedArrayEnd
Expected a ']' character
LeadingArrayComma
Array content starts with a leading ','.
TrailingArrayComma
Array content ends with a trailing ','.
ExpectedObjectCommaOrEnd
Expected this character to be either a ',' or a '}'.
ExpectedObjectEnd
Expected this character to be '}'.
LeadingObjectComma
Object content starts with a leading ,.
TrailingObjectComma
Object content ends with a trailing ,.
ExpectedToken
Expected to parse either true, false, or null.
ExpectedNull
Expected null
ExpectedString
Expected a " character
ExpectedArray
Expected an array
ExpectedObject
Expected an object
ExpectedStruct
Expected an object or an array
ExpectedEnumValue
Expected this character to start an enum variant.
ExpectedEnumObjectEnd
Expected this character to be '}'.
InvalidNumber
Invalid number
InvalidType
Invalid type
InvalidUnicodeCodePoint
Invalid unicode code point
KeyMustBeAString
Object key is not a string
TrailingCharacters
JSON has non-whitespace trailing characters after the value
UnexpectedChar
Unexpected character
InvalidLength
Invalid length
DeserializeError(String)
std or alloc only.An error passed down from a serde::de::Deserialize implementation
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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
Source§impl Error for Error
Available on crate features std or alloc only.
impl Error for Error
std or alloc only.Source§fn custom<T: Display>(msg: T) -> Self
fn custom<T: Display>(msg: T) -> Self
Source§fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_type(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize receives a type different from what it was
expecting. Read moreSource§fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
fn invalid_value(unexp: Unexpected<'_>, exp: &dyn Expected) -> Self
Deserialize receives a value of the right type but that
is wrong for some other reason. Read moreSource§fn invalid_length(len: usize, exp: &dyn Expected) -> Self
fn invalid_length(len: usize, exp: &dyn Expected) -> Self
Source§fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
fn unknown_variant(variant: &str, expected: &'static [&'static str]) -> Self
Deserialize enum type received a variant with an
unrecognized name.Source§fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self
Deserialize struct type received a field with an
unrecognized name.Source§fn missing_field(field: &'static str) -> Self
fn missing_field(field: &'static str) -> Self
Deserialize struct type expected to receive a required
field with a particular name but that field was not present in the
input.Source§fn duplicate_field(field: &'static str) -> Self
fn duplicate_field(field: &'static str) -> Self
Deserialize struct type received more than one of the
same field.