IntoIterator
Here’s an important takeaway from our VecIter
in the previous lesson: a Vec
on its own doesn’t have enough information to be iterated over. We need to know the current position in the iteration, and a Vec
doesn’t have that information. Therefore, it’s impossible to have an Iterator
implementation for Vec
. And sure enough, there is no such implementation available. We can even demonstrate that by trying to use the next
method directly on a Vec
: