Skip to content

Commit

Permalink
impl FusedStream for Buffered (#2676)
Browse files Browse the repository at this point in the history
  • Loading branch information
arcnmx authored and taiki-e committed Jan 30, 2023
1 parent b8ef941 commit dca8ffa
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion futures-util/src/stream/stream/buffered.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::stream::{Fuse, FuturesOrdered, StreamExt};
use crate::stream::{Fuse, FusedStream, FuturesOrdered, StreamExt};
use core::fmt;
use core::pin::Pin;
use futures_core::future::Future;
Expand Down Expand Up @@ -95,6 +95,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

0 comments on commit dca8ffa

Please sign in to comment.