Skip to content

Commit 09d54eb

Browse files
authored
impl FusedStream for Buffered (#2676)
1 parent 7a487f5 commit 09d54eb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

futures-util/src/stream/stream/buffered.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::stream::{Fuse, FuturesOrdered, StreamExt};
1+
use crate::stream::{Fuse, FusedStream, FuturesOrdered, StreamExt};
22
use core::fmt;
33
use core::num::NonZeroUsize;
44
use core::pin::Pin;
@@ -100,6 +100,16 @@ where
100100
}
101101
}
102102

103+
impl<St> FusedStream for Buffered<St>
104+
where
105+
St: Stream,
106+
St::Item: Future,
107+
{
108+
fn is_terminated(&self) -> bool {
109+
self.stream.is_done() && self.in_progress_queue.is_terminated()
110+
}
111+
}
112+
103113
// Forwarding impl of Sink from the underlying stream
104114
#[cfg(feature = "sink")]
105115
impl<S, Item> Sink<Item> for Buffered<S>

0 commit comments

Comments
 (0)