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 { ... }
}
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§

source

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§

source

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.

Implementations on Foreign Types§

source§

impl IntoDeError for Infallible

source§

fn into_de_error<E: Error>(self, _expected: Option<&dyn Expected>) -> E

source§

impl IntoDeError for ParseIntError

source§

fn into_de_error<E: Error>(self, expected: Option<&dyn Expected>) -> E

source§

fn try_into_de_error<E>( self, expected: Option<&dyn Expected> ) -> Result<E, Self>where E: Error,

Implementors§