Struct scopeguard::Guard
[−]
[src]
pub struct Guard<T, F> where F: FnMut(&mut T) {
// some fields omitted
}Guard is a scope guard that may own a protected value.
If you place a guard value in a local variable, its destructor will run regardless how you leave the function — regular return or panic (barring abnormal incidents like aborts; so as long as destructors run).
The guard's closure will be called with a mut ref to the held value in the destructor. It's called only once.
The Guard implements Deref so that you can access the inner value.