use core::marker; use stream::Stream; use {Poll, Async}; /// A stream which contains no elements. /// /// This stream can be created with the `stream::empty` function. #[derive(Debug)] #[must_use = "streams do nothing unless polled"] pub struct Empty { _data: marker::PhantomData<(T, E)>, } /// Creates a stream which contains no elements. /// /// The returned stream will always return `Ready(None)` when polled. pub fn empty() -> Empty { Empty { _data: marker::PhantomData } } impl Stream for Empty { type Item = T; type Error = E; fn poll(&mut self) -> Poll, Self::Error> { Ok(Async::Ready(None)) } }