Function replace_drop

Source
pub fn replace_drop<T: ReplaceDropImpl>(val: T)
Expand description

Works like drop(val) but uses the ReplaceDropImpl Example:

use replace_drop::{ReplaceDropImpl, replace_drop};
struct MyData { data: i32 }
unsafe impl ReplaceDropImpl for MyData {
    unsafe fn drop(&mut self) {
        println!("Called replace_drop with {}", self.data)
    }    
}

let data = MyData {data: 3};
let data2 = MyData {data: 3};
drop(data); // Prints nothing
replace_drop(data2); // Prints "Called replace_drop with 3"