Trait error_backtrace::ErrorBacktrace

source ·
pub trait ErrorBacktrace {
    // Required method
    fn is_error(&self) -> bool;

    // Provided methods
    fn trace(self) -> Self
       where Self: Sized { ... }
    fn backtrace(self) -> Self
       where Self: Sized { ... }
    fn handle_error(self) -> Self
       where Self: Sized { ... }
}

Required Methods§

source

fn is_error(&self) -> bool

Provided Methods§

source

fn trace(self) -> Self
where Self: Sized,

Examples found in repository?
examples/example.rs (line 19)
18
19
20
fn error_source() -> Result<(), ()> {
    Err(()).trace()
}
source

fn backtrace(self) -> Self
where Self: Sized,

Examples found in repository?
examples/example.rs (line 4)
3
4
5
6
fn main() -> Result<(), ()> {
    maybe_error().backtrace()?;
    Ok(())
}
source

fn handle_error(self) -> Self
where Self: Sized,

Examples found in repository?
examples/example.rs (line 10)
8
9
10
11
12
13
14
15
16
fn maybe_error() -> Result<(), ()> {
    error_source()?;
    match error_source().handle_error() {
        Ok(x) => x,
        Err(e) => e,
    };

    Ok(())
}

Implementations on Foreign Types§

source§

impl ErrorBacktrace for dyn Error

source§

fn is_error(&self) -> bool

source§

impl<T1> ErrorBacktrace for Option<T1>

source§

fn is_error(&self) -> bool

source§

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

source§

fn is_error(&self) -> bool

Implementors§