Tucker Barbour
05/24/2021, 3:27 PMCoroutineScope
? e.g.
class MyClass : CoroutineScope by CoroutineScope(Dispatchers.Default) {
fun doSomething() = produce {
trySendBlocking(...)
}
}
The objective is to have MyClass.doSomething
return a ReceiveChannel using produce
. Extending CoroutineScope seemed to be the most straightfoward way to accomplish this.Zach Klippenstein (he/him) [MOD]
05/24/2021, 3:28 PMTucker Barbour
05/24/2021, 3:31 PMprivate val scope = CoroutineScope(Dispachers.Default)
fun doSomething() = scope.produce { ... }
Tucker Barbour
05/24/2021, 3:31 PMlazy
?Zach Klippenstein (he/him) [MOD]
05/24/2021, 3:34 PMZach Klippenstein (he/him) [MOD]
05/24/2021, 3:37 PMTucker Barbour
05/24/2021, 3:38 PMErik
05/24/2021, 4:01 PM