1
0
mirror of https://github.com/danog/byte-stream.git synced 2024-11-30 04:19:23 +01:00

Use a Producer in the IteratorStream docs

This commit is contained in:
Niklas Keller 2017-05-22 10:36:19 +02:00
parent 75b2f2098c
commit 2049e76771

View File

@ -3,16 +3,10 @@
`IteratorStream` allows converting an `Amp\Iterator` that yields strings into an `InputStream`.
```php
$emitter = new Emitter;
asyncCoroutine(function () use ($emitter) {
$inputStream = new IteratorStream(new Producer(function (callable $emit) {
for ($i = 0; $i < 10; $i++) {
yield new Delayed(1000);
yield $emitter->emit(".");
yield $emit(".");
}
$emitter->complete();
});
$inputStream = new IteratorStream($emitter->iterate());
```