Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Unified Diff: sdk/lib/async/stream.dart

Issue 1189873004: Update documentation of Stream.pipe to match behavior. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Change text again, mention addStream explicitly. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/stream.dart
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index 3f11b91f080054036bd969eb3f7e77f3d32e12ff..725644562145d09e9241df40ff67f0589aa11f17 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -478,12 +478,22 @@ abstract class Stream<T> {
}
/**
- * Binds this stream as the input of the provided [StreamConsumer].
+ * Pipe the events of this stream into [streamConsumer].
*
- * The `streamConsumer` is closed when the stream has been added to it.
+ * The events of this stream are added to `streamConsumer` using
+ * [StreamConsumer.addStream].
+ * The `streamConsumer` is closed when this stream has been successfully added
+ * to it - when the future returned by `addStream` completes without an error.
*
* Returns a future which completes when the stream has been consumed
* and the consumer has been closed.
+ *
+ * The returned future completes with the same result as the future returned
+ * by [StreamConsumer.close].
+ * If the adding of the stream itself fails in some way,
+ * then the consumer is expected to be closed, and won't be closed again.
+ * In that case the returned future completes with the error from calling
+ * `addStream`.
*/
Future pipe(StreamConsumer<T> streamConsumer) {
return streamConsumer.addStream(this).then((_) => streamConsumer.close());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698