pub trait Error: Sized + StdError {
// Required methods
fn custom<T>(msg: T) -> Self
where T: Display;
fn wrong_name(name: &ExpandedName<'_>, expected: &ExpandedName<'_>) -> Self;
fn unexpected_visit<T>(unexpected: Unexpected, expected: &T) -> Self;
fn missing_field(field: &str) -> Self;
fn no_possible_variant(ident: &str) -> Self;
fn missing_data() -> Self;
fn unknown_child() -> Self;
fn invalid_string() -> Self;
}
Expand description
A trait for errors that can be returned by a Deserializer
.
Required Methods§
Sourcefn custom<T>(msg: T) -> Selfwhere
T: Display,
fn custom<T>(msg: T) -> Selfwhere
T: Display,
Error for when a custom error occurs during deserialization.
Sourcefn wrong_name(name: &ExpandedName<'_>, expected: &ExpandedName<'_>) -> Self
fn wrong_name(name: &ExpandedName<'_>, expected: &ExpandedName<'_>) -> Self
Error for when a name is expected to be a certain value, but it is not.
Sourcefn unexpected_visit<T>(unexpected: Unexpected, expected: &T) -> Self
fn unexpected_visit<T>(unexpected: Unexpected, expected: &T) -> Self
Error for when a type is expected to be a certain type, but it is not.
Sourcefn missing_field(field: &str) -> Self
fn missing_field(field: &str) -> Self
Error for when a field is missing.
Sourcefn no_possible_variant(ident: &str) -> Self
fn no_possible_variant(ident: &str) -> Self
Error for when a type has no possible variants to deserialize into.
Sourcefn missing_data() -> Self
fn missing_data() -> Self
Error for when a type is missing data that is required to deserialize it.
Sourcefn unknown_child() -> Self
fn unknown_child() -> Self
Error for when a child cannot be identified, and ignoring it is not allowed.
Sourcefn invalid_string() -> Self
fn invalid_string() -> Self
Error for when a string is invalid for the type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.