Skip to content

Commit 14cf135

Browse files
dekellumcramertj
authored andcommitted
Doc clarify StreamExt::forward usage
1 parent 2d12746 commit 14cf135

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

futures-util/src/stream/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,10 @@ pub trait StreamExt: Stream {
10681068
/// This future will drive the stream to keep producing items until it is
10691069
/// exhausted, sending each item to the sink. It will complete once the
10701070
/// stream is exhausted, the sink has received and flushed all items, and
1071-
/// the sink is closed.
1071+
/// the sink is closed. Note that neither the original stream nor provided
1072+
/// sink will be output by this future. Pass the sink by `Pin<&mut S>`
1073+
/// (for example, via `forward(&mut sink)` inside an `async` fn/block) in
1074+
/// order to preserve access to the Sink.
10721075
fn forward<S>(self, sink: S) -> Forward<Self, S>
10731076
where
10741077
S: Sink<<Self as TryStream>::Ok>,

0 commit comments

Comments
 (0)