From 158811a6cd6dea520b07e64670fc55197b344055 Mon Sep 17 00:00:00 2001 From: Jonathan Giddy Date: Thu, 19 Jan 2023 05:25:05 +0000 Subject: [PATCH] Implement `FusedStream` for all streams in `ReadyChunks` `ReadyChunks` fuses the inner stream, so `FusedStream` can be implemented for all stream types, not just those that initially implement `FusedStream`. --- futures-util/src/stream/stream/ready_chunks.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/futures-util/src/stream/stream/ready_chunks.rs b/futures-util/src/stream/stream/ready_chunks.rs index ab8637f27..192054c4a 100644 --- a/futures-util/src/stream/stream/ready_chunks.rs +++ b/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}; @@ -22,7 +22,7 @@ impl ReadyChunks { 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, (.)); @@ -75,7 +75,7 @@ impl Stream for ReadyChunks { } } -impl FusedStream for ReadyChunks { +impl FusedStream for ReadyChunks { fn is_terminated(&self) -> bool { self.stream.is_terminated() }