awaitNext: Wait for the next value from a channel or stream.

View source: R/stream.R

awaitNextR Documentation

Wait for the next value from a channel or stream.

Description

awaitNext can be used within an async or stream coroutine. When reached, awaitNext will register to receive the next element from an async or a coroutine object.

Usage

awaitNext(strm, or, err)

Arguments

strm

A channel or stream object.

or

This argument will be evaluated and returned in the case the channel closes. If not specified, awaiting on a closed stream will raise an error with message "StopIteration".

err

A function to be called if the channel throws an error condition.

Value

In the context of an async or stream, awaitNext(x) returns the resolved value of a promise x, or stops with an error.


crowding/generators documentation built on June 28, 2023, 6:14 a.m.