1 /* 2 * Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. 3 */ 4 5 package kotlinx.coroutines.reactive 6 7 import kotlinx.coroutines.channels.* 8 import org.reactivestreams.* 9 import kotlin.coroutines.* 10 11 /** @suppress */ 12 @Deprecated(message = "Deprecated in the favour of consumeAsFlow()", 13 level = DeprecationLevel.HIDDEN, // Error in 1.4, HIDDEN in 1.6.0 14 replaceWith = ReplaceWith("this.consumeAsFlow().asPublisher(context)", imports = ["kotlinx.coroutines.flow.consumeAsFlow"])) <lambda>null15public fun <T> ReceiveChannel<T>.asPublisher(context: CoroutineContext = EmptyCoroutineContext): Publisher<T> = publish(context) { 16 for (t in this@asPublisher) 17 send(t) 18 } 19