Skip to content

Commit 9685d93

Browse files
ebkalderoncramertj
authored andcommitted
Change Forward to drop sink after completion
1 parent 380a88b commit 9685d93

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

futures-util/src/stream/forward.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ where
7171
Si: Sink + Unpin,
7272
St: Stream<Item = Result<Si::SinkItem, Si::SinkError>>,
7373
{
74-
type Output = Result<Si, Si::SinkError>;
74+
type Output = Result<(), Si::SinkError>;
7575

7676
fn poll(
7777
mut self: Pin<&mut Self>,
@@ -91,7 +91,8 @@ where
9191
Poll::Ready(None) => {
9292
try_ready!(self.as_mut().sink().as_pin_mut().expect(INVALID_POLL)
9393
.poll_close(waker));
94-
return Poll::Ready(Ok(self.as_mut().sink().take().unwrap()))
94+
let _ = self.as_mut().sink().take().unwrap();
95+
return Poll::Ready(Ok(()))
9596
}
9697
Poll::Pending => {
9798
try_ready!(self.as_mut().sink().as_pin_mut().expect(INVALID_POLL)

futures-util/src/stream/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -976,12 +976,6 @@ pub trait StreamExt: Stream {
976976
/// exhausted, sending each item to the sink. It will complete once both the
977977
/// stream is exhausted and the sink has received and flushed all items.
978978
/// Note that the sink is **not** closed.
979-
///
980-
/// On completion, the sink is returned.
981-
///
982-
/// Note that this combinator is only usable with `Unpin` sinks.
983-
/// Sinks that are not `Unpin` will need to be pinned in order to be used
984-
/// with `forward`.
985979
fn forward<S>(self, sink: S) -> Forward<Self, S>
986980
where
987981
S: Sink + Unpin,

0 commit comments

Comments
 (0)