Trait destream::de::Error

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

    // Provided methods
    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 { ... }
}
Expand description

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§

source

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

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

Provided Methods§

source

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

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

source

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

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

source

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

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

Object Safety§

This trait is not object safe.

Implementors§