Feature gate: #![feature(iter_collect_into)]
This is a tracking issue for adding the collect_into method to the Iterator trait.
Iterator::collect_into lets an iterator to be collected into a collection which implements the Extend trait, consuming the iterator and adding every of its item to the collection.
Adding this method has also the benefit of making the Extend trait more discoverable.
Public API
trait Iterator {
type Item;
fn collect_into<E: Extend<Self::Item>>(self, collection: &mut E) -> &mut E
where
Self: Sized;
}
Steps / History
Unresolved Questions
Feature gate:
#![feature(iter_collect_into)]This is a tracking issue for adding the
collect_intomethod to theIteratortrait.Iterator::collect_intolets an iterator to be collected into a collection which implements theExtendtrait, consuming the iterator and adding every of its item to the collection.Adding this method has also the benefit of making the
Extendtrait more discoverable.Public API
Steps / History
Unresolved Questions
Iteratorinterface is already pretty large, and use cases can easily be written differently without this API.