Skip to main content

EnrichableExt

Trait EnrichableExt 

Source
pub trait EnrichableExt: Enrichable {
    // Provided methods
    fn enrich(self, msg: impl Into<Cow<'static, str>>) -> Self
       where Self: Sized { ... }
    fn enrich_with<F, R>(self, f: F) -> Self
       where F: FnOnce() -> R,
             R: Into<Cow<'static, str>>,
             Self: Sized { ... }
}
Expand description

Extension trait providing ergonomic error enrichment methods.

Provided Methods§

Source

fn enrich(self, msg: impl Into<Cow<'static, str>>) -> Self
where Self: Sized,

Adds enrichment information to the error.

It uses Location::caller to capture the file and line number where this method is invoked.

Source

fn enrich_with<F, R>(self, f: F) -> Self
where F: FnOnce() -> R, R: Into<Cow<'static, str>>, Self: Sized,

Adds lazily evaluated enrichment information to the error.

It uses Location::caller to capture the file and line number where this method is invoked.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§