Skip to content

Commit cb0711e

Browse files
authored
Document flush behavior on error for send_all & forward (#2404)
Signed-off-by: ktf <[email protected]>
1 parent f02a451 commit cb0711e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

futures-util/src/sink/mod.rs

+2-1
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

+2-1
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,8 @@ pub trait StreamExt: Stream {
14841484
/// the sink is closed. Note that neither the original stream nor provided
14851485
/// sink will be output by this future. Pass the sink by `Pin<&mut S>`
14861486
/// (for example, via `forward(&mut sink)` inside an `async` fn/block) in
1487-
/// order to preserve access to the `Sink`.
1487+
/// order to preserve access to the `Sink`. If the stream produces an error,
1488+
/// that error will be returned by this future without flushing/closing the sink.
14881489
#[cfg(feature = "sink")]
14891490
#[cfg_attr(docsrs, doc(cfg(feature = "sink")))]
14901491
fn forward<S>(self, sink: S) -> Forward<Self, S>

0 commit comments

Comments
 (0)