From bf2565baa0648170a4b7f0674ddbcf38a390959d Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Mon, 22 May 2017 10:33:48 +0200 Subject: [PATCH] Add IteratorStream docs --- docs/iterator-stream.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/iterator-stream.md b/docs/iterator-stream.md index 3045528..968a1d9 100644 --- a/docs/iterator-stream.md +++ b/docs/iterator-stream.md @@ -1,3 +1,16 @@ # IteratorStream -TBD +`IteratorStream` allows converting an `Amp\Iterator` that yields strings into an `InputStream`. + +```php +$emitter = new Emitter; + +asyncCoroutine(function () use ($emitter) { + for ($i = 0; $i < 10; $i++) { + yield new Delayed(1000); + yield $emitter->emit("."); + } +}); + +$inputStream = new IteratorStream($emitter->iterate()); +```