Trait Error

Source
pub trait Error: Sized {
    // Required methods
    fn syntax(msg: &str) -> Self;
    fn end_of_stream() -> Self;
    fn unknown_field(field: &str) -> Self;
    fn missing_field(field: &'static str) -> Self;

    // Provided methods
    fn length_mismatch(_len: usize) -> Self { ... }
    fn type_mismatch(_type: Type) -> Self { ... }
    fn invalid_value(msg: &str) -> Self { ... }
}
Expand description

Error is a trait that allows a Deserialize to generically create a Deserializer error.

Required Methods§

Source

fn syntax(msg: &str) -> Self

Raised when there is general error when deserializing a type.

Source

fn end_of_stream() -> Self

Raised when a Deserialize type unexpectedly hit the end of the stream.

Source

fn unknown_field(field: &str) -> Self

Raised when a Deserialize struct type received an unexpected struct field.

Source

fn missing_field(field: &'static str) -> Self

Raised when a Deserialize struct type did not receive a field.

Provided Methods§

Source

fn length_mismatch(_len: usize) -> Self

Raised when a fixed sized sequence or map was passed in the wrong amount of arguments.

Source

fn type_mismatch(_type: Type) -> Self

Raised when a Deserialize was passed an incorrect type.

Source

fn invalid_value(msg: &str) -> Self

Raised when a Deserialize was passed an incorrect value.

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.

Implementors§