async_std/collections/btree_set/extend.rs
1use std::collections::BTreeSet;
2use std::pin::Pin;
3
4use crate::prelude::*;
5use crate::stream::{self, IntoStream};
6
7impl<T: Ord + Send> stream::Extend<T> for BTreeSet<T> {
8 fn extend<'a, S: IntoStream<Item = T> + 'a>(
9 &'a mut self,
10 stream: S,
11 ) -> Pin<Box<dyn Future<Output = ()> + 'a + Send>>
12 where
13 <S as IntoStream>::IntoStream: Send,
14 {
15 Box::pin(stream.into_stream().for_each(move |item| {
16 self.insert(item);
17 }))
18 }
19}