use async_stream::stream;
use futures::Stream;
use kanal::AsyncReceiver;
pub trait KanalExt<T> {
fn into_stream(self) -> impl Stream<Item = T>;
}
impl<T> KanalExt<T> for AsyncReceiver<T> {
fn into_stream(self) -> impl Stream<Item = T> {
stream! {
while let Ok(next) = self.recv().await {
yield next
}
}
}
}