Iterator is a trait that defines how to produce a sequence of items one by one, while IntoIterator is a trait that converts a collection into an Iterator.
use std::iter::{Iterator, IntoIterator};
fn main() {
let v = vec![1, 2, 3];
// IntoIterator: Converts the vector into an iterator (consumes v)
let iter: impl Iterator<Item = i32> = v.into_iter();
// Iterator: Consumes the iterator to get the next item
if let Some(first) = iter.next() {
println!("First item: {}", first);
}
}