3个不稳定版本
0.2.0 | 2019年6月12日 |
---|---|
0.1.1 | 2019年4月5日 |
0.1.0 | 2019年4月5日 |
#3 in #finally
用于 redmine-api
4KB
finally-block

Final block是当它被丢弃时执行的一个代码块。它帮助用户编写那些即使在某些语句提前返回时也应该执行的延迟语句。
function f(flag: &AtomicBool) -> Option<()> {
if some_condition {
let _f = finally(|| {
flag.store(true, Ordering::SeqCst);
});
some_function(flag)?;
} else {
another_function()?;
}
}