mirror of
https://github.com/danog/amp.git
synced 2024-12-02 09:27:46 +01:00
Squash leftover Stream references
This commit is contained in:
parent
9a2a4966c6
commit
45481a710c
@ -31,7 +31,7 @@ Loop::run(function () {
|
|||||||
Promise\rethrow(new Coroutine($generator($emitter)));
|
Promise\rethrow(new Coroutine($generator($emitter)));
|
||||||
|
|
||||||
while (yield $iterator->advance()) {
|
while (yield $iterator->advance()) {
|
||||||
printf("Stream emitted %d\n", $iterator->getCurrent());
|
printf("Emitter emitted %d\n", $iterator->getCurrent());
|
||||||
yield new Pause(500); // Listener consumption takes 500 ms.
|
yield new Pause(500); // Listener consumption takes 500 ms.
|
||||||
}
|
}
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
|
@ -29,7 +29,7 @@ Loop::run(function () {
|
|||||||
$iterator = $emitter->getIterator();
|
$iterator = $emitter->getIterator();
|
||||||
|
|
||||||
while (yield $iterator->advance()) {
|
while (yield $iterator->advance()) {
|
||||||
printf("Stream emitted %d\n", $iterator->getCurrent());
|
printf("Emitter emitted %d\n", $iterator->getCurrent());
|
||||||
yield new Delayed(100); // Listener consumption takes 100 ms.
|
yield new Delayed(100); // Listener consumption takes 100 ms.
|
||||||
}
|
}
|
||||||
} catch (\Throwable $exception) {
|
} catch (\Throwable $exception) {
|
||||||
|
@ -24,7 +24,7 @@ Loop::run(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
while (yield $iterator->advance()) {
|
while (yield $iterator->advance()) {
|
||||||
printf("Stream emitted %d\n", $iterator->getCurrent());
|
printf("Producer emitted %d\n", $iterator->getCurrent());
|
||||||
yield new Delayed(100); // Listener consumption takes 100 ms.
|
yield new Delayed(100); // Listener consumption takes 100 ms.
|
||||||
}
|
}
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
|
@ -84,7 +84,7 @@ try {
|
|||||||
* prevent IDEs and other tools from reporting multiple definitions.
|
* prevent IDEs and other tools from reporting multiple definitions.
|
||||||
*/
|
*/
|
||||||
eval('namespace Amp;
|
eval('namespace Amp;
|
||||||
final class Emitter implements Stream {
|
final class Emitter implements Iterator {
|
||||||
use Internal\Producer { emit as public; complete as public; fail as public; }
|
use Internal\Producer { emit as public; complete as public; fail as public; }
|
||||||
public function getIterator(): Iterator { return $this; }
|
public function getIterator(): Iterator { return $this; }
|
||||||
}');
|
}');
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace Amp;
|
namespace Amp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines an asynchronous stream that is designed to be used within a coroutine.
|
* Defines an asynchronous iterator over a set of values that is designed to be used within a coroutine.
|
||||||
*/
|
*/
|
||||||
interface Iterator {
|
interface Iterator {
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user