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

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

    pub fn invalid_type<U: Display>(unexp: U, exp: &dyn Expected) -> Self { ... }
pub fn invalid_value<U: Display>(unexp: U, exp: &dyn Expected) -> Self { ... }
pub fn invalid_length(len: usize, exp: &dyn Expected) -> Self { ... }
pub fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self { ... }
pub fn missing_field(field: &'static str) -> Self { ... }
pub fn duplicate_field(field: &'static str) -> 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

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

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

Loading content...

Provided methods

pub fn invalid_type<U: Display>(unexp: U, exp: &dyn Expected) -> Self[src]

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

pub fn invalid_value<U: Display>(unexp: U, exp: &dyn Expected) -> Self[src]

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

pub fn invalid_length(len: usize, exp: &dyn Expected) -> Self[src]

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

pub fn unknown_field(field: &str, expected: &'static [&'static str]) -> Self[src]

Raised when FromStream receives a field with an unrecognized name.

pub fn missing_field(field: &'static str) -> Self[src]

Raised when FromStream expected to receive a required field with a particular name but that field was not present in the input.

pub fn duplicate_field(field: &'static str) -> Self[src]

Raised when FromStream receives more than one of the same field.

Loading content...

Implementors

Loading content...