PublisherCoroutine

class PublisherCoroutine<in T> : 
    AbstractCoroutine<Unit>,
    ProducerScope<T>,
    Subscription,
    SelectClause2<T, SendChannel<T>>

Constructors

<init>

PublisherCoroutine(
    parentContext: CoroutineContext,
    subscriber: Subscriber<T>,
    exceptionOnCancelHandler: (Throwable, CoroutineContext) -> Unit)

Properties

channel

val channel: SendChannel<T>

isClosedForSend

val isClosedForSend: Boolean

isFull

val isFull: Boolean

onSend

val onSend: SelectClause2<T, SendChannel<T>>

Functions

cancel

fun cancel(): Unit

close

fun close(cause: Throwable?): Boolean

invokeOnClose

fun invokeOnClose(handler: (Throwable?) -> Unit): Nothing

offer

fun offer(element: T): Boolean

onCancelled

fun onCancelled(cause: Throwable, handled: Boolean): Unit

onCompleted

fun onCompleted(value: Unit): Unit

registerSelectClause2

fun <R> registerSelectClause2(
    select: SelectInstance<R>,
    element: T,
    block: suspend (SendChannel<T>) -> R
): Unit

request

fun request(n: Long): Unit

send

suspend fun send(element: T): Unit

Extension Functions

publish

fun <T> CoroutineScope.publish(
    context: CoroutineContext = EmptyCoroutineContext,
    block: suspend ProducerScope<T>.() -> Unit
): Publisher<T>