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

Unified Diff: lib/src/concatenate_streams.dart

Issue 1648963002: Add reactive-inspired stream transformers: Base URL: https://github.com/dart-lang/async@master
Patch Set: Restructure failes and add more tests. Created 4 years, 10 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
Index: lib/src/concatenate_streams.dart
diff --git a/lib/src/concatenate_streams.dart b/lib/src/concatenate_streams.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d910be0f1b8bfabe72201be8aeeb81732fcbec3e
--- /dev/null
+++ b/lib/src/concatenate_streams.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "dart:async";
+
+/// Concatenates streams.
+///
+/// The events of each stream in [streams] are emitted, one stream at a time
+/// in iteration order. When the final stream in [streams] has been processed,
+/// the returned stream closes.
+///
+/// If the listener on the concatenated stream cancels early, later streams are
+/// not listened to at all.
nweiz 2016/03/01 02:10:03 It may be worth mentioning that an iterator may be
Lasse Reichstein Nielsen 2016/03/01 16:51:16 Good point.
+Stream concatenateStreams(Iterable<Stream> streams) async* {
nweiz 2016/03/01 02:10:03 I can buy having fatal errors in scan, because the
Lasse Reichstein Nielsen 2016/03/01 16:51:16 This will forward both value and error events to t
nweiz 2016/03/08 23:57:34 Oh, interesting. I was under the impression that a
+ for (var stream in streams) {
+ yield* stream;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698