Skip to content

Commit

Permalink
merge quiver.streams into quiver.async (fixes #177)
Browse files Browse the repository at this point in the history
  • Loading branch information
yjbanov committed Jun 17, 2015
1 parent abc705c commit 671f1bc
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 81 deletions.
30 changes: 13 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ We recommend the following version constraint:

Utilities for working with Futures, Streams and async computations.

`collect` collects the completion events of an `Iterable` of `Future`s into a
`Stream`.

`enumerate` and `concat` represent `Stream` versions of the same-named
[quiver.iterables][] methods.

`doWhileAsync`, `reduceAsync` and `forEachAsync` perform async computations on
the elements of on Iterables, waiting for the computation to complete before
processing the next element.

`StreamBuffer` allows for the orderly reading of elements from a stream, such
as a socket.

`FutureGroup` is collection of Futures that signals when all its child futures
have completed. Allows adding new Futures as long as it hasn't completed yet.
Useful when async tasks can spwn new async tasks and you need to wait for all of
Expand All @@ -39,10 +52,6 @@ predicates.
`CountdownTimer` is a simple countdown timer that fires events in regular
increments.

`doWhileAsync`, `reduceAsync` and `forEachAsync` perform async computations on
the elements of on Iterables, waiting for the computation to complete before
processing the next element.

`CreateTimer` and `CreateTimerPeriodic` are typedefs that are useful for
passing Timer factories to classes and functions, increasing the testability of
code that depends on Timer.
Expand Down Expand Up @@ -164,19 +173,6 @@ used as a literal match inside of a RegExp.

[quiver.pattern]: http://www.dartdocs.org/documentation/quiver/latest#quiver/quiver-pattern

## [quiver.streams][]

`collect` collects the completion events of an `Iterable` of `Future`s into a
`Stream`.

`enumerate` and `concat` represent `Stream` versions of the same-named
[quiver.iterables][] methods.

`StreamBuffer` allows for the orderly reading of elements from a stream, such
as a socket.

[quiver.streams]: http://www.dartdocs.org/documentation/quiver/latest#quiver/quiver-streams

## [quiver.strings][]

`isBlank` checks if a string is `null`, empty or made of whitespace characters.
Expand Down
5 changes: 5 additions & 0 deletions lib/async.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ library quiver.async;

import 'dart:async';

import 'package:quiver/iterables.dart' show IndexedValue;
import 'package:quiver/time.dart';

part 'src/async/collect.dart';
part 'src/async/countdown_timer.dart';
part 'src/async/concat.dart';
part 'src/async/enumerate.dart';
part 'src/async/future_group.dart';
part 'src/async/future_stream.dart';
part 'src/async/iteration.dart';
part 'src/async/metronome.dart';
part 'src/async/stream_buffer.dart';
part 'src/async/stream_router.dart';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of quiver.streams;
part of quiver.async;

/**
* Returns a stream of completion events for the input [futures].
Expand Down
2 changes: 1 addition & 1 deletion lib/src/streams/concat.dart → lib/src/async/concat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of quiver.streams;
part of quiver.async;

/**
* Returns the concatentation of the input streams.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of quiver.streams;
part of quiver.async;

/**
* Returns a [Stream] of [IndexedValue]s where the nth value holds the nth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

part of quiver.streams;
part of quiver.async;

/**
* Underflow errors happen when the socket feeding a buffer is finished while
Expand Down
23 changes: 0 additions & 23 deletions lib/streams.dart

This file was deleted.

2 changes: 0 additions & 2 deletions test/all_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import 'io_test.dart' as io;
import 'iterables/all_tests.dart' as iterables;
import 'mirrors_test.dart' as mirrors;
import 'pattern/all_tests.dart' as pattern;
import 'streams/all_tests.dart' as streams;
import 'strings_test.dart' as strings;
import 'testing/all_tests.dart' as testing;
import 'time/all_tests.dart' as time;
Expand All @@ -38,7 +37,6 @@ main() {
iterables.main();
mirrors.main();
pattern.main();
streams.main();
strings.main();
testing.main();
time.main();
Expand Down
8 changes: 8 additions & 0 deletions test/async/all_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,28 @@

library quiver.async.all_tests;

import 'collect_test.dart' as collect;
import 'concat_test.dart' as concat;
import 'countdown_timer_test.dart' as countdown_timer;
import 'create_timer_test.dart' as create_timer;
import 'enumerate_test.dart' as enumerate;
import 'future_group_test.dart' as future_group;
import 'future_stream_test.dart' as future_stream;
import 'iteration_test.dart' as iteration;
import 'metronome_test.dart' as metronome;
import 'stream_buffer_test.dart' as stream_buffer;
import 'stream_router_test.dart' as stream_router;

main() {
collect.main();
concat.main();
countdown_timer.main();
create_timer.main();
enumerate.main();
future_group.main();
future_stream.main();
metronome.main();
iteration.main();
stream_buffer.main();
stream_router.main();
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

library quiver.streams.collect_test;
library quiver.async.collect_test;

import 'dart:async';
import 'dart:math';

import 'package:test/test.dart';
import 'package:quiver/streams.dart';
import 'package:quiver/async.dart';

main() {
group('collect', () {
Expand Down
4 changes: 2 additions & 2 deletions test/streams/concat_test.dart → test/async/concat_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

library quiver.streams.concat_test;
library quiver.async.concat_test;

import 'dart:async';

import 'package:test/test.dart';
import 'package:quiver/streams.dart';
import 'package:quiver/async.dart';

main() {
group('concat', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

library quiver.streams.enumerate_test;
library quiver.async.enumerate_test;

import 'dart:async';

import 'package:test/test.dart';
import 'package:quiver/streams.dart';
import 'package:quiver/async.dart';

main() {
group('enumerate', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.

library quiver.streams.streambuffer_test;
library quiver.async.stream_buffer_test;

import 'dart:async';
import 'package:test/test.dart';
import 'package:quiver/streams.dart';
import 'package:quiver/async.dart';

void main() {
group("StreamBuffer", () {
Expand Down
27 changes: 0 additions & 27 deletions test/streams/all_tests.dart

This file was deleted.

0 comments on commit 671f1bc

Please sign in to comment.