consume
inline fun <E, R> BroadcastChannel<E>.consume(block: ReceiveChannel<E>.() -> R): R
Content copied to clipboard
Opens subscription to this BroadcastChannel and makes sure that the given block consumes all elements from it by always invoking cancel after the execution of the block.
Note: This API will become obsolete in future updates with introduction of lazy asynchronous streams. See issue #254.
inline fun <E, R> ReceiveChannel<E>.consume(block: ReceiveChannel<E>.() -> R): R
Content copied to clipboard
Makes sure that the given block consumes all elements from the given channel by always invoking cancel after the execution of the block.
The operation is terminal.