https://kotlinlang.org logo
e

elizarov

06/22/2017, 8:38 AM
We plan to introduce
pipe
function for channel-to-channel transfer. Using
pipe
the code can be made even more natural without constraint on the ordering:
Copy code
fun BluetoothSocket.asyncListen() = produce(context) { ... } // natural-looking producer
fun configIncomingData(): BroadcastChannel<String> { ... } // broadcast consumer
// use it like this:
val producer = asyncListen()
val consumer = configIncomingData()
pipe(producer, consumer)