Macro try_block::try_block[][src]

macro_rules! try_block {
    { $($token:tt)* } => { ... };
}

Macro to make your error-handling blocks (appear) lambda-less

Before:

let result: Result<T, E> = || {
   let a = do_one(x)?;
   let b = do_two(a)?;
   Ok(b)
}();

After:

let result: Result<T, E> = try_block! {
   let a = do_one(x)?;
   let b = do_two(a)?;
   Ok(b)
};