Skip to main content

ErrorContext

Trait ErrorContext 

Source
pub trait ErrorContext<T> {
    // Required methods
    fn with_context<F>(self, f: F) -> Result<T, MetisError>
       where F: FnOnce() -> String;
    fn with_static_context(self, context: &'static str) -> Result<T, MetisError>;
}
Expand description

Trait for converting errors with additional context

Required Methods§

Source

fn with_context<F>(self, f: F) -> Result<T, MetisError>
where F: FnOnce() -> String,

Add context to an error result

Source

fn with_static_context(self, context: &'static str) -> Result<T, MetisError>

Add static context to an error result

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T, E> ErrorContext<T> for Result<T, E>
where E: Into<MetisError>,

Source§

fn with_context<F>(self, f: F) -> Result<T, MetisError>
where F: FnOnce() -> String,

Source§

fn with_static_context(self, context: &'static str) -> Result<T, MetisError>

Implementors§