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 committed Dec 19, 2022
1 parent 7a487f5 commit 09d54eb
Showing 1 changed file with 11 additions and 1 deletion.
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

0 comments on commit 09d54eb

Please sign in to comment.