Skip to main content

managed_resource

Function managed_resource 

Source
pub fn managed_resource<T, F>(resource: T, cleanup: F) -> ResourceGuard<T>
where F: FnOnce(T) + Send + 'static,
Expand description

Convenience function to create a simple resource guard

This function creates a guard that will call the cleanup function when the resource is no longer needed.