``` fun <E> ReceiveChannel<E>.onEach(c...
# coroutines
e
Copy code
fun <E> ReceiveChannel<E>.onEach(context: CoroutineContext = Unconfined, action: (E) -> Unit): ReceiveChannel<E> =
    produce(context) {
        consumeEach {
            action(it)
            send(it)
        }
    }
r
As I mentioned, I already tried
map()
which does the same under the hood. Two things I don't really like about this: 1. I need to pass
capacity
as
map()
creates
produce(capacity = 0)
2. I'm creating several `Channel`s, which are passed as
ReceiveChannel
in one place and
SendChannel
in the other one, so I have to put this
onEach
specifically on
ReceiveChannel
side, which isn't very convenient. So I'll probably stick with derivative class for debugging purposes for now.