async_shared_timeout/wrapper/
stream.rs1use core::{
2 pin::Pin,
3 task::{Context, Poll},
4};
5
6use crate::runtime::Runtime;
7use futures_core::Stream;
8
9use super::Wrapper;
10
11#[cfg_attr(docsrs, doc(cfg(feature = "stream")))]
12impl<R: Runtime, T: Stream> Stream for Wrapper<'_, R, T> {
13 type Item = T::Item;
14 fn size_hint(&self) -> (usize, Option<usize>) {
15 self.inner.size_hint()
16 }
17 fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
18 let pinned = self.project();
19 match pinned.inner.poll_next(cx) {
20 Poll::Ready(x) => {
21 pinned.timeout.as_ref().reset();
22 Poll::Ready(x)
23 }
24 Poll::Pending => Poll::Pending,
25 }
26 }
27}