pub trait IntoDeError: Sized {
// Required method
fn into_de_error<E: Error>(self, expected: Option<&dyn Expected>) -> E;
// Provided method
fn try_into_de_error<E>(
self,
expected: Option<&dyn Expected>,
) -> Result<E, Self>
where E: Error { ... }
}
Available on crate feature
serde
only.Expand description
Converts given error type to a type implementing de::Error
.
This is used in Deserialize
implementations to convert specialized errors into serde
errors.
Required Methods§
Sourcefn into_de_error<E: Error>(self, expected: Option<&dyn Expected>) -> E
fn into_de_error<E: Error>(self, expected: Option<&dyn Expected>) -> E
Converts to deserializer error possibly outputting vague message.
This method is allowed to return a vague error message if the error type doesn’t contain enough information to explain the error precisely.
Provided Methods§
Sourcefn try_into_de_error<E>(
self,
expected: Option<&dyn Expected>,
) -> Result<E, Self>where
E: Error,
fn try_into_de_error<E>(
self,
expected: Option<&dyn Expected>,
) -> Result<E, Self>where
E: Error,
Converts to deserializer error without outputting vague message.
If the error type doesn’t contain enough information to explain the error precisely this
should return Err(self)
allowing the caller to use its information instead.
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.