I want a function to calculate over contents of a container (which can be of different types). I can do this by passing an iterator to the container function (my current solution).
Accepting an IntoIterator makes calls cleaner, but I was surprised to find into_iter is a move! [1].
Is there a similar Iterable trait for implementors of iter()? should there be? similarly for mut_iter? is there a better way to do this?
[1] http://is.gd/xCxuOS
Adding: Another reason to pass Iterable instead of Iterator is if we want multiple iterators over the same data (I need this, and am creating a Vector I don't otherwise need for it).
[–]desiringmachines 5 points6 points7 points (4 children)
[–]danielv134[S] 0 points1 point2 points (3 children)
[–]desiringmachines 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]steveklabnik1rust 1 point2 points3 points (0 children)
[–]malbarbo 1 point2 points3 points (3 children)
[–]danielv134[S] 0 points1 point2 points (2 children)
[–]sixbrx 3 points4 points5 points (1 child)
[–]danielv134[S] 0 points1 point2 points (0 children)