pub trait ResultExt<T, E> {
    // Required method
    fn context<X>(self, x: X) -> Result<T, Context<X, E>>;
}
Expand description

Result extension trait adding a context method

Required Methods§

source

fn context<X>(self, x: X) -> Result<T, Context<X, E>>

The method is use to add context information to current operation

The context data is then used in error constructor to store additional information within error. For example, you may add a filename as a context for file operation. See crate documentation for the actual example.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T, E> ResultExt<T, E> for Result<T, E>

source§

fn context<X>(self, x: X) -> Result<T, Context<X, E>>

Implementors§