Skip to content

Commit

Permalink
util: implement Stream for CopyToBytes of Stream
Browse files Browse the repository at this point in the history
  • Loading branch information
nicflower committed Aug 23, 2023
1 parent 09aa7f4 commit 83b564d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tokio-util/src/io/copy_to_bytes.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -66,3 +67,10 @@ where
self.project().inner.poll_close(cx)
}
}

impl<S: Stream> Stream for CopyToBytes<S> {
type Item = S::Item;
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
self.project().inner.poll_next(cx)
}
}

0 comments on commit 83b564d

Please sign in to comment.