Skip to main content

WithContext

Trait WithContext 

Source
pub trait WithContext<T> {
    // Required method
    fn with_context(self, ctx: &str) -> Result<T>;
}
Expand description

Attach a context string to a Result, wrapping the error in a new General message that includes the original error’s display text.

Required Methods§

Source

fn with_context(self, ctx: &str) -> Result<T>

Wrap any error with an additional context prefix.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T, E: Display> WithContext<T> for Result<T, E>

Source§

fn with_context(self, ctx: &str) -> Result<T>

Implementors§