How to fix Rust E0277 Iterator not implemented

Fix Rust E0277 by calling .iter() on your collection to implement the Iterator trait before using iterator methods.

The E0277 error occurs because the type you are using does not implement the Iterator trait, so you must call .iter() (or .into_iter()) to convert it into an iterator before using methods like .map() or .for_each().

let numbers = vec![1, 2, 3];
// Fix: Call .iter() to get an iterator
for n in numbers.iter() {
    println!("{}", n);
}