src/Text/TextWriter.php
public function flush(): \Generator
    {
        if ($this->buffer->isEmpty()) {
            return 0;
        }

        return yield from $this->stream->write($this->buffer->drain(), $this->timeout);
    }
public function flush(): \Generator
    {
        if ($this->buffer->isEmpty()) {
            return 0;
        }

        return yield from $this->stream->write($this->buffer->drain(), $this->timeout);
    }
@coroutine

Flushes the contents of the internal buffer to the underlying stream.

@return \Generator

@resolve int Number of bytes written to the stream.

@throws \Icicle\Awaitable\Exception\TimeoutException If the operation times out.
@throws \Icicle\Stream\Exception\UnwritableException If the stream is no longer writable.
@throws \Icicle\Stream\Exception\ClosedException If the stream is unexpectedly closed.