kotlin-flow-extensions / hu.akarnokd.kotlin.flow / ResumableCollector

ResumableCollector

open class ResumableCollector<T> : Resumable

A collector that hosts a signal (value/error/completion) and allows waiting for the signal and a consumer to be ready to receive them.

Constructors

<init>

ResumableCollector()

A collector that hosts a signal (value/error/completion) and allows waiting for the signal and a consumer to be ready to receive them.

Properties

error

var error: Throwable?

value

var value: T

Functions

complete

suspend fun complete(): Unit

drain

suspend fun drain(collector: FlowCollector<T>, onComplete: (ResumableCollector<T>) -> Unit = null): Unit

error

suspend fun error(error: Throwable): Unit

next

suspend fun next(value: T): Unit

Inherited Functions

await

suspend fun await(): Unit

Await the resumption of this Resumable, suspending the current coroutine if necessary. Only one thread can call this method.

resume

fun resume(): Unit

Resume this Resumable, resuming any currently suspended await callers. This method can be called by any number of threads.