2020-05-13 17:15:21 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Amp;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A stream is an asynchronous set of ordered values.
|
|
|
|
*
|
|
|
|
* @template-covariant TValue
|
|
|
|
*/
|
|
|
|
interface Stream
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Succeeds with a tuple of the yielded value and key or null if the stream has completed. If the stream fails,
|
|
|
|
* the returned promise will fail with the same exception.
|
|
|
|
*
|
2020-05-16 17:39:34 +02:00
|
|
|
* @return Promise<array|null>
|
|
|
|
*
|
|
|
|
* @psalm-return Promise<list<TValue>|null>
|
2020-05-13 17:15:21 +02:00
|
|
|
*
|
|
|
|
* @throws \Throwable The exception used to fail the stream.
|
|
|
|
*/
|
|
|
|
public function continue(): Promise;
|
2020-05-13 21:59:31 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Disposes of the stream, indicating the consumer is no longer interested in the stream output.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function dispose();
|
2020-05-13 17:15:21 +02:00
|
|
|
}
|