Function defer

Source
pub fn defer<F>(f: F) -> impl Drop
where F: FnOnce(),
Expand description

RAII-style guard for executing a closure at the end of a scope.

This synchronous variant does not require async. Inspired by Go’s defer.