Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pub struct Data {
- id: u32,
- }
- impl Drop for Data {
- fn drop(&mut self) {
- println!("drop {}", self.id);
- }
- }
- fn main() {
- let vec = vec![Data{id: 1}, Data{id: 2}];
- for (i, _) in vec.into_iter().enumerate() {
- println!("do {}", i);
- }
- println!("THE END");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement