result_try

Macro result_try 

Source
macro_rules! result_try {
    ($rc_expr:expr) => { ... };
}
Expand description

Wraps and returns a given result if it’s not successful

§Examples

fn demo() -> Result<()> {
    // Won't do anything
    result_try!(ResultCode::new(0));
    result_try!(ResultSuccess::make());    

    // Will exit with the given results
    result_try!(ResultCode::new(0xCAFE));
    result_try!(ResultDemo::make());

    Ok(())
}