chj_rustbin/util/
scope.rs

1/// Make a delimited for temporary objects. Unlike `{ ... }` which is
2/// not enough, this macro also includes a `;` which does the
3/// trick. Useful e.g. to limit the scope of Mutex or RefCell guards.
4#[macro_export]
5macro_rules! scope {
6    { $($code:tt)* } => {{
7        let res = {
8            $($code)*
9        };
10        res
11    }}
12}