Trait destream::de::Error[][src]

pub trait Error: Send + Sized + Error {
    fn custom<T: Display>(msg: T) -> Self;

    fn invalid_type<U: Display, E: Display>(unexp: U, exp: E) -> Self { ... }
fn invalid_value<U: Display, E: Display>(unexp: U, exp: E) -> Self { ... }
fn invalid_length<E: Display>(len: usize, exp: E) -> Self { ... } }

The Error trait allows FromStream implementations to create descriptive error messages belonging to their Decoder context.

Most implementors should only need to provide the Error::custom method and inherit the default behavior for the other methods.

Based on serde::de::Error.

Required methods

fn custom<T: Display>(msg: T) -> Self[src]

Raised when there is general error when decoding a type. The message should not be capitalized and should not end with a period.

Loading content...

Provided methods

fn invalid_type<U: Display, E: Display>(unexp: U, exp: E) -> Self[src]

Raised when FromStream receives a type different from what it was expecting.

fn invalid_value<U: Display, E: Display>(unexp: U, exp: E) -> Self[src]

Raised when FromStream receives a value of the right type but that is wrong for some other reason.

fn invalid_length<E: Display>(len: usize, exp: E) -> Self[src]

Raised when decoding a sequence or map and the input data contains too many or too few elements.

Loading content...

Implementors

Loading content...