Trait IntoErrorReporter

Source
pub trait IntoErrorReporter<E, C, CO>
where E: Error + Send + Sync + 'static,
{ // Required method fn ext_context(self, context: CO) -> ErrorReporter<E, C>; }
Expand description

Helper trait for creating error reporters from context in extension Traits

This trait is intended to be used by extension traits for Result so that you can write combinators that work on either std::error::Error types directly (thus creating a new ErrorReporter) or on types that own an ErrorReporter, which lets you implement error types with APIs such as in the example

§Example of supported APIs

let val = fallible_fn()
            .note("This function can only be used in certain situations")
            .warn("Be careful not to use this fn in this specific situation")?;

Required Methods§

Source

fn ext_context(self, context: CO) -> ErrorReporter<E, C>

Implementors§

Source§

impl<C, CO, E> IntoErrorReporter<E, C, CO> for ErrorReporter<E, C>
where E: Error + Send + Sync + 'static, C: ErrorContext<CO>,

Source§

impl<E, C, CO> IntoErrorReporter<E, C, CO> for E
where C: Default + ErrorContext<CO>, E: Error + Send + Sync + 'static,