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

BufferingResumableCollector

open class BufferingResumableCollector<T> : Resumable

A collector that can buffer a fixed number of items and drain it with much less need to coordinate the resumption per items.

Constructors

<init>

BufferingResumableCollector(capacity: Int)

A collector that can buffer a fixed number of items and drain it with much less need to coordinate the resumption per items.

Functions

complete

fun complete(): Unit

drain

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

error

fun error(ex: 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.