destructor
The clean-up code that runs when a value is dropped.
A destructor is a type's Drop implementation; a type with one can never be Copy (E0184).
Examples
impl Drop for Noisy { fn drop(&mut self) { println!("bye"); } }printsbyewhen aNoisygoes out of scope.Adding
#[derive(Clone, Copy)]to a type that implementsDropfails with E0184.
See also