OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
| 7 export 'src/delegating_stream_channel.dart'; |
7 export 'src/multi_channel.dart'; | 8 export 'src/multi_channel.dart'; |
8 | 9 |
9 /// An abstract class representing a two-way communication channel. | 10 /// An abstract class representing a two-way communication channel. |
10 /// | 11 /// |
11 /// Subclasses are strongly encouraged to mix in or extend [StreamChannelMixin] | 12 /// Subclasses are strongly encouraged to mix in or extend [StreamChannelMixin] |
12 /// to get default implementations of the various instance methods. Adding new | 13 /// to get default implementations of the various instance methods. Adding new |
13 /// methods to this interface will not be considered a breaking change if | 14 /// methods to this interface will not be considered a breaking change if |
14 /// implementations are also added to [StreamChannelMixin]. | 15 /// implementations are also added to [StreamChannelMixin]. |
15 abstract class StreamChannel<T> { | 16 abstract class StreamChannel<T> { |
16 /// The stream that emits values from the other endpoint. | 17 /// The stream that emits values from the other endpoint. |
(...skipping 24 matching lines...) Expand all Loading... |
41 } | 42 } |
42 | 43 |
43 /// A mixin that implements the instance methods of [StreamChannel] in terms of | 44 /// A mixin that implements the instance methods of [StreamChannel] in terms of |
44 /// [stream] and [sink]. | 45 /// [stream] and [sink]. |
45 abstract class StreamChannelMixin<T> implements StreamChannel<T> { | 46 abstract class StreamChannelMixin<T> implements StreamChannel<T> { |
46 void pipe(StreamChannel<T> other) { | 47 void pipe(StreamChannel<T> other) { |
47 stream.pipe(other.sink); | 48 stream.pipe(other.sink); |
48 other.stream.pipe(sink); | 49 other.stream.pipe(sink); |
49 } | 50 } |
50 } | 51 } |
OLD | NEW |