From 83b564d2fbea67a1a0127765f6354881e1e88489 Mon Sep 17 00:00:00 2001 From: Nicola Fiorella Date: Tue, 22 Aug 2023 09:57:18 +0200 Subject: [PATCH] util: implement Stream for CopyToBytes of Stream --- tokio-util/src/io/copy_to_bytes.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tokio-util/src/io/copy_to_bytes.rs b/tokio-util/src/io/copy_to_bytes.rs index 9509e711932..f0b5c3579a6 100644 --- a/tokio-util/src/io/copy_to_bytes.rs +++ b/tokio-util/src/io/copy_to_bytes.rs @@ -1,4 +1,5 @@ use bytes::Bytes; +use futures_core::stream::Stream; use futures_sink::Sink; use pin_project_lite::pin_project; use std::pin::Pin; @@ -66,3 +67,10 @@ where self.project().inner.poll_close(cx) } } + +impl Stream for CopyToBytes { + type Item = S::Item; + fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + self.project().inner.poll_next(cx) + } +}