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

Side by Side Diff: sdk/lib/async/stream.dart

Issue 99463005: Update stream iterator doc and add test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.async; 5 part of dart.async;
6 6
7 // ------------------------------------------------------------------- 7 // -------------------------------------------------------------------
8 // Core Stream types 8 // Core Stream types
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 10
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 1334
1335 Stream<T> bind(Stream<S> stream); 1335 Stream<T> bind(Stream<S> stream);
1336 } 1336 }
1337 1337
1338 /** 1338 /**
1339 * An [Iterable] like interface for the values of a [Stream]. 1339 * An [Iterable] like interface for the values of a [Stream].
1340 * 1340 *
1341 * This wraps a [Stream] and a subscription on the stream. It listens 1341 * This wraps a [Stream] and a subscription on the stream. It listens
1342 * on the stream, and completes the future returned by [moveNext] when the 1342 * on the stream, and completes the future returned by [moveNext] when the
1343 * next value becomes available. 1343 * next value becomes available.
1344 *
1345 * NOTICE: This is a tentative design. This class may change.
1346 */ 1344 */
1347 abstract class StreamIterator<T> { 1345 abstract class StreamIterator<T> {
1348 1346
1349 /** Create a [StreamIterator] on [stream]. */ 1347 /** Create a [StreamIterator] on [stream]. */
1350 factory StreamIterator(Stream<T> stream) 1348 factory StreamIterator(Stream<T> stream)
1351 // TODO(lrn): use redirecting factory constructor when type 1349 // TODO(lrn): use redirecting factory constructor when type
1352 // arguments are supported. 1350 // arguments are supported.
1353 => new _StreamIteratorImpl<T>(stream); 1351 => new _StreamIteratorImpl<T>(stream);
1354 1352
1355 /** 1353 /**
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 class _ControllerEventSinkWrapper<T> implements EventSink<T> { 1395 class _ControllerEventSinkWrapper<T> implements EventSink<T> {
1398 EventSink _sink; 1396 EventSink _sink;
1399 _ControllerEventSinkWrapper(this._sink); 1397 _ControllerEventSinkWrapper(this._sink);
1400 1398
1401 void add(T data) { _sink.add(data); } 1399 void add(T data) { _sink.add(data); }
1402 void addError(error, [StackTrace stackTrace]) { 1400 void addError(error, [StackTrace stackTrace]) {
1403 _sink.addError(error, stackTrace); 1401 _sink.addError(error, stackTrace);
1404 } 1402 }
1405 void close() { _sink.close(); } 1403 void close() { _sink.close(); }
1406 } 1404 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/async/stream_impl.dart » ('j') | tests/lib/async/stream_iterator_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698