use std::ops::Drop; struct Foo(usize); impl Drop for Foo { fn drop(&mut self) { println!("I had a {}", self.0); } }