Struct drop_guard::DropGuard
[−]
[src]
pub struct DropGuard<T, F: FnMut(T)> { /* fields omitted */ }
Methods
impl<T: Sized, F: FnMut(T)> DropGuard<T, F>
[src]
fn new(data: T, func: F) -> DropGuard<T, F>
Creates a new guard taking in your data and a function.
use drop_guard::DropGuard; let s = String::from("a commonString"); let mut s = DropGuard::new(s, |final_string| println!("s became {} at last", final_string)); // much code and time passes by ... *s = "a rainbow".to_string(); // by the end of this function the String will have become a rainbow
Trait Implementations
impl<T, F: FnMut(T)> Deref for DropGuard<T, F>
[src]
type Target = T
The resulting type after dereferencing
fn deref(&self) -> &T
The method called to dereference a value
impl<T, F: FnMut(T)> DerefMut for DropGuard<T, F>
[src]
fn deref_mut(&mut self) -> &mut T
The method called to mutably dereference a value