Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd Iterator::into_vec() #40051
Comments
This comment has been minimized.
This comment has been minimized.
leonardo-m
commented
Feb 23, 2017
|
Is the "to_vec" name better (and shorter)? |
This comment has been minimized.
This comment has been minimized.
|
The other container I very frequently see Whether or not we do that, I'd prefer the |
This comment has been minimized.
This comment has been minimized.
|
I think this can be done in your own crate. The motivation of adding it to std is not strong enough. |
This comment has been minimized.
This comment has been minimized.
leonardo-m
commented
Feb 24, 2017
•
|
If your program is short, doing this in your own crate is overkill. I think it's a good idea to have a standard method like this because
Sometimes you can replace The need for conversion to a vector is very common (but once the impl trait feature becomes stable, more functions will return an iterator, so some usages of The itertools crate has this function, named " https://docs.rs/itertools/0.5.9/itertools/trait.Itertools.html#method.collect_vec |
This comment has been minimized.
This comment has been minimized.
|
Note that |
This comment has been minimized.
This comment has been minimized.
|
Wishes for new features (things that are not defects) are filed in the rust-lang/rfcs repo. I think the most successful way to get a new feature into Rust would be something like:
I'll close this issue with that information. |
bluss
closed this
Feb 24, 2017
This comment has been minimized.
This comment has been minimized.
|
This topic is moved to this thread. Thank you for letting me know the right place to post it. |
HyeonuPark commentedFeb 23, 2017
•
edited
Though we have nice
Iterator::collect(), the most common use cases of this method as I've seen aremy_iter.collect::Vec<_>(), which is a bit complicated to type. So it would be worth to add this simple shortcut method for it.