use core::{
fmt,
marker::PhantomData,
pin::Pin,
task::{Context, Poll},
};
use crate::EventIterator;
pub struct Empty<E>(PhantomData<E>);
impl<E> fmt::Debug for Empty<E> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("Empty").field(&format_args!("_")).finish()
}
}
impl<E> EventIterator for Empty<E> {
type Event<'me> = E where Self: 'me;
fn poll_next<'a>(
self: Pin<&'a Self>,
_cx: &mut Context<'_>,
) -> Poll<Option<Self::Event<'a>>> {
Poll::Ready(None)
}
fn size_hint(&self) -> (usize, Option<usize>) {
(0, Some(0))
}
}
#[doc = include_str!("../examples/empty.rs")]
pub fn empty<E>() -> Empty<E> {
Empty(PhantomData::<E>)
}