macro_rules! buf_try {
($e:expr) => { ... };
($e:expr, $b:expr) => { ... };
(@try $e:expr) => { ... };
}
Expand description
A helper macro to imitate the behavior of try trait ?
.
fn foo() -> BufResult<i32, i32> {
let (a, b) = buf_try!(BufResult(Ok(1), 2));
assert_eq!(a, 1);
assert_eq!(b, 2);
(Ok(3), 4).into()
}
assert!(foo().is_ok());