Is there a way to use a select expression with som...
# coroutines
k
Is there a way to use a select expression with something that's not a channel?
d
Yes! You can select on anything (using the right abstraction)!
What about
ByteReadChannel
do you want to select?
k
Well it's a custom type I'm reading
But it gives an error,
Suspend functions can only be called within a coroutine body
Looking at
onReceive()
It seems I need a
SelectClauseX
?
d
You'll basically have to wrap the call in
async
and select using the
onAwait
.
You could also implement your own select clause but iirc it's experimental and there little docs about writing them.
k
thanks