Skip to main content

Result

Type Alias Result 

Source
pub type Result<T, C = Dynamic> = Result<T, Report<C>>;
Expand description

A Result type alias where the error is Report.

This is a convenient shorthand for functions that return errors as Report. The context type defaults to Dynamic.

§Examples

use rootcause::prelude::*;

fn might_fail() -> rootcause::Result<String> {
    Ok("success".to_string())
}

With a typed error:

use rootcause::prelude::*;

#[derive(Debug)]
struct MyError;

fn typed_error() -> rootcause::Result<String, MyError> {
    Err(report!(MyError))
}

Aliased Type§

pub enum Result<T, C = Dynamic> {
    Ok(T),
    Err(Report<C>),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(Report<C>)

Contains the error value