Hi, I am kind of stuck with the task of moving a collection into an iterator of its values, but where each item itself can be moved out of the iterator.
Usually I use .into_iter()
to move an iterator out of a collection of T
, but this creates an Iterator<Item=&'a T>
, so I can't move out of the iterator when processing it partially, i.e. without consuming the entire iterator, because the values are owned by the iterator, if I understand correctly.
So basically I am looking for a way to turn a Vec<T>
into an Iterator<Item=T>
without cloning, but by moving the values into the iterator, and moving them out of the iterator when they are consumed.
Does this make sense? Is it possible?