Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl FusedStream for Buffered #2676

Merged
merged 1 commit into from Dec 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 11 additions & 1 deletion 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;
Expand Down Expand Up @@ -100,6 +100,16 @@ where
}
}

impl<St> FusedStream for Buffered<St>
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<S, Item> Sink<Item> for Buffered<S>
Expand Down