https://kotlinlang.org logo
#kroto-plus
Title
# kroto-plus
r

rocketraman

11/21/2019, 11:59 PM
Aha, this code has a runBlocking in a suspend function, not good!
m

mkerr

11/22/2019, 3:59 AM
What is it supposed to use if you need a coroutine context? EX: I wrote some code in a generateSequence call that needed to call another suspend.
override suspend foo() = coroutineScope { generateSequence { bar() }. forEach( baz(it) ) }
bar invocation gets an IDE error in IJ saying a context is needed for a suspend fn call
For context I’m using this on a streaming gRPC endpoint with the KrotoPlus coroutine support
r

rocketraman

11/22/2019, 4:30 AM
Use the
sequence
builder, which provides a suspendable
SequenceScope
in which you generate your sequence.
@mkerr -^
m

mkerr

11/22/2019, 4:33 AM
cool thanks
4 Views