macro_rules! try_scope {
($($t:tt)*) => { ... };
}Expand description
Just like the unstable try block, this macro runs the code inside of it, but in a context
where returns return from it instead of the top function, acting like a try-catch in a
traditional language. This is done by immediately calling a closure.
ยงExample
use functionality::try_scope;
let r = try_scope! {
let x = Err("helloo")?;
Ok(())
};
assert_eq!(r, Err("helloo"));