pub fn defer<F>(func: F) -> Deferred<F>where F: FnOnce(),
Defers a function so that it is called when dropped.