pub trait Error:
Sized
+ Error
+ From<Error> {
// Required methods
fn with_kind(self, kind: &'static str) -> Self;
fn custom<T>(msg: T) -> Self
where T: Display;
// Provided methods
fn invalid_type<U, E>(unexp: U, exp: E) -> Self
where U: Display,
E: Display { ... }
fn invalid_value<U, E>(unexp: U, exp: E) -> Self
where U: Display,
E: Display { ... }
fn invalid_length<E>(len: usize, exp: E) -> Self
where E: Display { ... }
}Required Methods§
Provided Methods§
Sourcefn invalid_type<U, E>(unexp: U, exp: E) -> Self
fn invalid_type<U, E>(unexp: U, exp: E) -> Self
Raised when receives a type different from what it was expecting.
Sourcefn invalid_value<U, E>(unexp: U, exp: E) -> Self
fn invalid_value<U, E>(unexp: U, exp: E) -> Self
Raised when receives a value of the right type but that is wrong for some other reason.
Sourcefn invalid_length<E>(len: usize, exp: E) -> Selfwhere
E: Display,
fn invalid_length<E>(len: usize, exp: E) -> Selfwhere
E: Display,
Raised when the input data contains too many or too few elements.
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.