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

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: 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..b85002d5926f15b7280ee0d9c0b061ddf215a295 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -478,12 +478,19 @@ 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 `streamConsumer` is closed when this stream has been successfully added
+ * to it.
+ * If the stream produces an error, the piping will stop after that error,
+ * and the stream consumer will not be closed.
*
* Returns a future which completes when the stream has been consumed
- * and the consumer has been closed.
+ * and the consumer has been closed,
+ * or after an error has made the piping stop.
Søren Gjesse 2015/06/17 10:56:04 In the error case the future completes with an err
Lasse Reichstein Nielsen 2015/06/18 08:47:06 Nope. Would be nice, but that's not what is happen
+ *
+ * The [streamConsumer] should not be used for adding other events until
+ * the returned future completes.
Søren Gjesse 2015/06/17 10:56:04 In the "success" case where the streamConsumer is
Lasse Reichstein Nielsen 2015/06/18 08:47:05 True. I'm not sure the behavior is actually what w
*/
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