/// Stores a function that will be executed once the finalizer has been dropped.
////// The default use case is to guarantee the execution of cleanup code.
pubstructFinalizer<F>
where
F: FnOnce(),{
f:Option<F>,}impl<F>Finalizer<F>where
F: FnOnce(),
{pubfnnew(f: F)->Self{let f =Some(f);
Finalizer { f }}}impl<F> Drop forFinalizer<F>where
F: FnOnce(),
{fndrop(&mutself){ifletSome(f)=self.f.take(){f();}}}