use core::pin::Pin;
use core::future::Future;
use crate::stream::IntoStream;
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
pub trait Extend<A> {
fn extend<'a, T: IntoStream<Item = A> + 'a>(
&'a mut self,
stream: T,
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send>>
where
<T as IntoStream>::IntoStream: Send;
}
#[cfg(feature = "unstable")]
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
pub async fn extend<'a, C, T, S>(collection: &mut C, stream: S)
where
C: Extend<T>,
S: IntoStream<Item = T> + 'a,
<S as IntoStream>::IntoStream: Send,
{
Extend::extend(collection, stream).await
}