Error

Trait Error 

Source
pub trait Error:
    Sized
    + 'static
    + Send
    + Sync
    + Display
    + Debug {
    // Required methods
    fn custom<T>(error: T) -> Self
       where T: 'static + Send + Sync + StdError;
    fn message<T>(message: T) -> Self
       where T: Display;
}
Expand description

Trait governing errors raised during encodeing or decoding.

Required Methods§

Source

fn custom<T>(error: T) -> Self
where T: 'static + Send + Sync + StdError,

Construct a custom error.

Source

fn message<T>(message: T) -> Self
where T: Display,

Collect an error from something that can be displayed.

This is made available to format custom error messages in no_std environments. The error message is to be collected by formatting T.

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.

Implementations on Foreign Types§

Source§

impl Error for String

Available on crate feature alloc only.
Source§

fn custom<T>(message: T) -> Self
where T: Display,

Source§

fn message<T>(message: T) -> Self
where T: Display,

Source§

impl Error for Error

Available on crate features std and alloc only.
Source§

fn custom<T>(message: T) -> Self
where T: 'static + Send + Sync + Display + Debug,

Source§

fn message<T>(message: T) -> Self
where T: Display,

Implementors§