scopeguard

Function guard

Source
pub fn guard<T, F>(v: T, dropfn: F) -> ScopeGuard<T, F, Always>
where F: FnOnce(T),
Expand description

Create a new ScopeGuard owning v and with deferred closure dropfn.