async_std/collections/linked_list/
extend.rs

1use std::collections::LinkedList;
2use std::pin::Pin;
3
4use crate::prelude::*;
5use crate::stream::{self, IntoStream};
6
7impl<T> stream::Extend<T> for LinkedList<T> {
8    fn extend<'a, S: IntoStream<Item = T> + 'a>(
9        &'a mut self,
10        stream: S,
11    ) -> Pin<Box<dyn Future<Output = ()> + 'a>> {
12        let stream = stream.into_stream();
13        Box::pin(stream.for_each(move |item| self.push_back(item)))
14    }
15}