macro_rules! defer {
($($t:tt)*) => { ... };
}Expand description
Calls the given closure at the end of the current scope
ยงExample
use rs42::defer;
use std::cell::Cell;
let nb = Cell::new(0);
{
defer!(nb.set(1));
assert_eq!(nb.get(), 0);
}
assert_eq!(nb.get(), 1);