Skip to content

Commit

Permalink
Implement FusedStream for all streams in ReadyChunks (#2693)
Browse files Browse the repository at this point in the history
`ReadyChunks` fuses the inner stream, so `FusedStream` can be
implemented for all stream types, not just those that initially
implement `FusedStream`.
  • Loading branch information
jongiddy authored and taiki-e committed Jan 30, 2023
1 parent f5733c9 commit bf3504b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions futures-util/src/stream/stream/ready_chunks.rs
@@ -1,4 +1,4 @@
use crate::stream::Fuse;
use crate::stream::{Fuse, StreamExt};
use alloc::vec::Vec;
use core::pin::Pin;
use futures_core::stream::{FusedStream, Stream};
Expand All @@ -22,7 +22,7 @@ impl<St: Stream> ReadyChunks<St> {
pub(super) fn new(stream: St, capacity: usize) -> Self {
assert!(capacity > 0);

Self { stream: super::Fuse::new(stream), cap: capacity }
Self { stream: stream.fuse(), cap: capacity }
}

delegate_access_inner!(stream, St, (.));
Expand Down Expand Up @@ -75,7 +75,7 @@ impl<St: Stream> Stream for ReadyChunks<St> {
}
}

impl<St: FusedStream> FusedStream for ReadyChunks<St> {
impl<St: Stream> FusedStream for ReadyChunks<St> {
fn is_terminated(&self) -> bool {
self.stream.is_terminated()
}
Expand Down

0 comments on commit bf3504b

Please sign in to comment.