futures_util/stream/
empty.rs1use core::marker;
2
3use futures_core::{Stream, Poll, Async};
4use futures_core::task;
5
6#[derive(Debug)]
10#[must_use = "streams do nothing unless polled"]
11pub struct Empty<T, E> {
12 _data: marker::PhantomData<(T, E)>,
13}
14
15pub fn empty<T, E>() -> Empty<T, E> {
19 Empty { _data: marker::PhantomData }
20}
21
22impl<T, E> Stream for Empty<T, E> {
23 type Item = T;
24 type Error = E;
25
26 fn poll_next(&mut self, _: &mut task::Context) -> Poll<Option<Self::Item>, Self::Error> {
27 Ok(Async::Ready(None))
28 }
29}