inline suspend fun <T> Publisher<T>.collect(action: (T) -> Unit)(source)

Subscribes to this Publisher and performs the specified action for each received element.

If action throws an exception at some point, the subscription is cancelled, and the exception is rethrown from collect. Also, if the publisher signals an error, that error is rethrown from collect.