Skip to main content

ReportableError

Trait ReportableError 

Source
pub trait ReportableError: Error + Sealed {
    // Required method
    fn as_dyn_error(&self) -> &(dyn Error + 'static);
}
Expand description

An error that the Flare client can report: an error type that does not borrow data, or a dyn Error.

Report::from_error and flareapp::report_error take this trait instead of Error. For a dyn Error, the Flare client looks up the real type of the error, like std::io::Error. Rust can only do that for an error that is 'static.

Every 'static type that implements Error implements this trait. dyn Error, dyn Error + Send and dyn Error + Send + Sync also implement this trait. Other crates cannot implement this trait.

In a function argument, write &(dyn Error + 'static) instead of &dyn Error. In that place, Rust reads &dyn Error as an error that can borrow data, and such an error does not implement this trait.

Required Methods§

Source

fn as_dyn_error(&self) -> &(dyn Error + 'static)

Returns the error as a dyn Error, so the Flare client can look up the real type of the error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ReportableError for dyn Error

Source§

fn as_dyn_error(&self) -> &(dyn Error + 'static)

Source§

impl ReportableError for dyn Error + Send

Source§

fn as_dyn_error(&self) -> &(dyn Error + 'static)

Source§

impl ReportableError for dyn Error + Send + Sync

Source§

fn as_dyn_error(&self) -> &(dyn Error + 'static)

Implementors§

Source§

impl<E> ReportableError for E
where E: Error + 'static,