Skip to main content

ResultExt

Trait ResultExt 

Source
pub trait ResultExt<T> {
    // Required methods
    fn with_context<F>(self, f: F) -> Result<T, Error>
       where F: FnOnce() -> String;
    fn table_context(self, table: &str) -> Result<T, Error>;
    fn column_context(self, table: &str, column: &str) -> Result<T, Error>;
}
Expand description

Extension trait for adding context to Results

Required Methods§

Source

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

Add context message on error

Source

fn table_context(self, table: &str) -> Result<T, Error>

Add table context to error message

Source

fn column_context(self, table: &str, column: &str) -> Result<T, Error>

Add table and column context to error message

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, E> ResultExt<T> for Result<T, E>
where E: Display,

Source§

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

Source§

fn table_context(self, table: &str) -> Result<T, Error>

Source§

fn column_context(self, table: &str, column: &str) -> Result<T, Error>

Implementors§