I think we should implement the trait FromIterator<A> for all types that conform to Default + Extend<A>. The implementation is:
impl<A, T> FromIterator<A> for T where T: Default + Extend<A> {
fn from_iter<T: IntoIterator<Item=A>>(iter: T) -> Self {
let mut result = <T as Default>::default();
<T as Extend<A>>::extend(&mut result, iter);
result
}
}
Motivation
The signature of Iterator::unzip is:
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
Self: Sized + Iterator<Item = (A, B)>
The return type of the method unzip is a tuple of types which implement Default + Extend respectively. If we implement FromIterator<T> for all types that already implement Default + Extend<T>, we can directly use the outputs of unzip where FromIterator<T> is expected.