Type Alias zebra_test::prelude::Result

source ·
pub type Result<T, E = Report> = Result<T, E>;
Expand description

type alias for Result<T, Report>

This is a reasonable return type to use throughout your application but also for fn main; if you do, failures will be printed along with a backtrace if one was captured.

eyre::Result may be used with one or two type parameters.

use eyre::Result;

fn demo1() -> Result<T> {...}
           // ^ equivalent to std::result::Result<T, eyre::Report>

fn demo2() -> Result<T, OtherError> {...}
           // ^ equivalent to std::result::Result<T, OtherError>

§Example

use eyre::Result;

fn main() -> Result<()> {
    let config = std::fs::read_to_string("cluster.json")?;
    let map: ClusterMap = serde_json::from_str(&config)?;
    println!("cluster info: {:#?}", map);
    Ok(())
}

Aliased Type§

enum Result<T, E = Report> {
    Ok(T),
    Err(E),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(E)

Contains the error value

Trait Implementations§

source§

impl<C, T, E> ContextFrom<C> for Result<T, E>
where E: Into<Report>, Report: ContextFrom<C, Return = Report>,

source§

type Return = Result<T, Report>

source§

fn context_from(self, source: C) -> Self::Return