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, T: IntoStream<Item = ()> + 'a>(
8        &'a mut self,
9        stream: T,
10    ) -> Pin<Box<dyn Future<Output = ()> + 'a>> {
11        let stream = stream.into_stream();
12
13        Box::pin(async move {
14            pin_utils::pin_mut!(stream);
15
16            while let Some(_) = stream.next().await {}
17        })
18    }
19}