[][src]Trait color_eyre::Help

pub trait Help<T>: Sealed {
    fn note<C>(self, context: C) -> Result<T>
    where
        C: Display + Send + Sync + 'static
;
fn with_note<C, F>(self, f: F) -> Result<T>
    where
        C: Display + Send + Sync + 'static,
        F: FnOnce() -> C
;
fn warning<C>(self, context: C) -> Result<T>
    where
        C: Display + Send + Sync + 'static
;
fn with_warning<C, F>(self, f: F) -> Result<T>
    where
        C: Display + Send + Sync + 'static,
        F: FnOnce() -> C
;
fn suggestion<C>(self, context: C) -> Result<T>
    where
        C: Display + Send + Sync + 'static
;
fn with_suggestion<C, F>(self, f: F) -> Result<T>
    where
        C: Display + Send + Sync + 'static,
        F: FnOnce() -> C
; }

A helper trait for attaching help text to errors to be displayed after the chain of errors

Required methods

fn note<C>(self, context: C) -> Result<T> where
    C: Display + Send + Sync + 'static, 

Add a note to an error, to be displayed after the chain of errors.

Examples

use color_eyre::Help as _;

fallible_fn().note("This might have failed due to ...")?;

fn with_note<C, F>(self, f: F) -> Result<T> where
    C: Display + Send + Sync + 'static,
    F: FnOnce() -> C, 

Add a Note to an error, to be displayed after the chain of errors, which is lazily evaluated only in the case of an error.

Examples

use color_eyre::Help as _;

fallible_fn().with_note(|| {
        format!("This might have failed due to ... It has failed {} times", 100)
    })?;

fn warning<C>(self, context: C) -> Result<T> where
    C: Display + Send + Sync + 'static, 

Add a Warning to an error, to be displayed after the chain of errors.

fn with_warning<C, F>(self, f: F) -> Result<T> where
    C: Display + Send + Sync + 'static,
    F: FnOnce() -> C, 

Add a Warning to an error, to be displayed after the chain of errors, which is lazily evaluated only in the case of an error.

fn suggestion<C>(self, context: C) -> Result<T> where
    C: Display + Send + Sync + 'static, 

Add a Suggestion to an error, to be displayed after the chain of errors.

fn with_suggestion<C, F>(self, f: F) -> Result<T> where
    C: Display + Send + Sync + 'static,
    F: FnOnce() -> C, 

Add a Suggestion to an error, to be displayed after the chain of errors, which is lazily evaluated only in the case of an error.

Loading content...

Implementations on Foreign Types

impl<T, E> Help<T> for Result<T, E> where
    E: Into<Report>, 
[src]

Loading content...

Implementors

Loading content...