Skip to content

Commit a94c4b8

Browse files
ktfftaiki-e
authored andcommitted
Document flush behavior on error for send_all & forward (#2404)
Signed-off-by: ktf <krunotf@gmail.com>
1 parent 9ddf0ad commit a94c4b8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

futures-util/src/sink/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ pub trait SinkExt<Item>: Sink<Item> {
243243
/// This future will drive the stream to keep producing items until it is
244244
/// exhausted, sending each item to the sink. It will complete once both the
245245
/// stream is exhausted, the sink has received all items, and the sink has
246-
/// been flushed. Note that the sink is **not** closed.
246+
/// been flushed. Note that the sink is **not** closed. If the stream produces
247+
/// an error, that error will be returned by this future without flushing the sink.
247248
///
248249
/// Doing `sink.send_all(stream)` is roughly equivalent to
249250
/// `stream.forward(sink)`. The returned future will exhaust all items from

futures-util/src/stream/stream/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,8 @@ pub trait StreamExt: Stream {
13291329
/// the sink is closed. Note that neither the original stream nor provided
13301330
/// sink will be output by this future. Pass the sink by `Pin<&mut S>`
13311331
/// (for example, via `forward(&mut sink)` inside an `async` fn/block) in
1332-
/// order to preserve access to the `Sink`.
1332+
/// order to preserve access to the `Sink`. If the stream produces an error,
1333+
/// that error will be returned by this future without flushing/closing the sink.
13331334
#[cfg(feature = "sink")]
13341335
#[cfg_attr(docsrs, doc(cfg(feature = "sink")))]
13351336
fn forward<S>(self, sink: S) -> Forward<Self, S>

0 commit comments

Comments
 (0)