Avatar ·

What is the difference between iter() and into_iter() in Rust?

Hello! I just started learning Rust and am trying to understand iterators. I read several articles, but I can't figure out the difference between the `iter()` and `into_iter()` methods. I wrote this code: ```rust let numbers = vec![1, 2, 3, 4, 5]; // Attempt 1: iter() for num in numbers.iter() { println!("{}", num); } println!("After iter(): {:?}", numbers); // Works // Attempt 2: into_iter() for num in numbers.into_iter() { println!("{}", num); } println!("After into_iter(): {:?}", numbers); // Error! ``` The first part of the code works fine, I can use `numbers` after the loop. But the second part gives a compilation error: `value used here after move`. I read that `into_iter()` consumes the collection, but I don't understand what that means in practice. Why can't I