Trait StopContext

Source
pub trait StopContext<T>: Sized {
    // Required methods
    fn stop_context(self, context: &'static str) -> Result<T, OrStopped>;
    fn unwrap_stopped(self, value: T) -> Result<T>;
}
Expand description

Extension trait for Result<_, OrStopped> similar to anyhow::Context.

Required Methods§

Source

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

Adds context to the internal error, if any.

Source

fn unwrap_stopped(self, value: T) -> Result<T>

Unwraps the Stopped variant to the supplied value, and the Internal variant to the underlying anyhow::Error.

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<T> StopContext<T> for Result<T, OrStopped>

Source§

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

Source§

fn unwrap_stopped(self, value: T) -> Result<T>

Implementors§