mod iter;
mod stream_ext;
use std::future::Future;
pub use iter::{iter, Iter};
pub use stream_ext::StreamExt;
#[must_use = "streams do nothing unless polled"]
pub trait Stream {
type Item;
fn next(&mut self) -> impl Future<Output = Option<Self::Item>>;
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
(0, None)
}
}
impl<S: ?Sized + Stream> Stream for &mut S {
type Item = S::Item;
fn next(&mut self) -> impl Future<Output = Option<Self::Item>> {
(**self).next()
}
}
pub(crate) fn assert_stream<T, S>(stream: S) -> S
where
S: Stream<Item = T>,
{
stream
}