async_std/unit/
extend.rs

1use std::pin::Pin;
2
3use crate::prelude::*;
4use crate::stream::{self, IntoStream};
5
6impl stream::Extend<()> for () {
7    fn extend<'a, S: IntoStream<Item = ()> + 'a>(
8        &'a mut self,
9        stream: S,
10    ) -> Pin<Box<dyn Future<Output = ()> + 'a + Send>> 
11    where
12        <S as IntoStream>::IntoStream: Send,
13    {
14        let stream = stream.into_stream();
15
16        Box::pin(async move {
17            pin_utils::pin_mut!(stream);
18
19            while let Some(_) = stream.next().await {}
20        })
21    }
22}