From 41aae70ce2fe6261c9bd64f39bf809f213cabdc8 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Sun, 18 Dec 2022 11:43:25 -0800 Subject: [PATCH] impl FusedStream for Buffered --- futures-util/src/stream/stream/buffered.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/futures-util/src/stream/stream/buffered.rs b/futures-util/src/stream/stream/buffered.rs index d1db71c317..41e2948639 100644 --- a/futures-util/src/stream/stream/buffered.rs +++ b/futures-util/src/stream/stream/buffered.rs @@ -1,4 +1,4 @@ -use crate::stream::{Fuse, FuturesOrdered, StreamExt}; +use crate::stream::{Fuse, FusedStream, FuturesOrdered, StreamExt}; use core::fmt; use core::num::NonZeroUsize; use core::pin::Pin; @@ -100,6 +100,16 @@ where } } +impl FusedStream for Buffered +where + St: Stream, + St::Item: Future, +{ + fn is_terminated(&self) -> bool { + self.stream.is_done() && self.in_progress_queue.is_terminated() + } +} + // Forwarding impl of Sink from the underlying stream #[cfg(feature = "sink")] impl Sink for Buffered