async_std/collections/vec_deque/
from_stream.rs1use std::collections::VecDeque;
2use std::pin::Pin;
3
4use crate::prelude::*;
5use crate::stream::{self, FromStream, IntoStream};
6
7impl<T: Send> FromStream<T> for VecDeque<T> {
8 #[inline]
9 fn from_stream<'a, S: IntoStream<Item = T> + 'a>(
10 stream: S,
11 ) -> Pin<Box<dyn Future<Output = Self> + 'a + Send>>
12 where
13 <S as IntoStream>::IntoStream: Send,
14 {
15 let stream = stream.into_stream();
16
17 Box::pin(async move {
18 let mut out = VecDeque::new();
19 stream::extend(&mut out, stream).await;
20 out
21 })
22 }
23}