From 38f0efb0e9abe8d7e9a22c903dad3aa9491aade0 Mon Sep 17 00:00:00 2001 From: David Kellum Date: Wed, 5 Jun 2019 14:22:04 -0700 Subject: [PATCH] Doc clarify StreamExt::forward usage --- futures-util/src/stream/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/futures-util/src/stream/mod.rs b/futures-util/src/stream/mod.rs index 6d0765cdef..f9b0b6cb06 100644 --- a/futures-util/src/stream/mod.rs +++ b/futures-util/src/stream/mod.rs @@ -1065,7 +1065,10 @@ pub trait StreamExt: Stream { /// This future will drive the stream to keep producing items until it is /// exhausted, sending each item to the sink. It will complete once the /// stream is exhausted, the sink has received and flushed all items, and - /// the sink is closed. + /// the sink is closed. Note that neither the original stream nor provided + /// sink will be output by this future. Pass the sink by `Pin<&mut S>` + /// (for example, via `forward(&mut sink)` inside an `async` fn/block) in + /// order to preserve access to the Sink. fn forward(self, sink: S) -> Forward where S: Sink<::Ok>,