fn collect<C: Default + Extend<Self::Item>>(self) -> Collect<Self, C>
    where
        Self: Sized,
    {
        assert_future::<C, _>(Collect::new(self))
    }
Transforms a stream into a collection, returning a
future representing the result of that computation.

The returned future will be resolved when the stream terminates.

# Examples

```
# futures::executor::block_on(async {
use futures::channel::mpsc;
use futures::stream::StreamExt;
use std::thread;

let (tx, rx) = mpsc::unbounded();

thread::spawn(move || {
for i in 1..=5 {
tx.unbounded_send(i).unwrap();
}
});

let output = rx.collect::<Vec<i32>>().await;
assert_eq!(output, vec![1, 2, 3, 4, 5]);
# });
```
futures-util/src/stream/stream/mod.rs