Package-level declarations

Types

Link copied to clipboard
typealias SuspendingInitializer<T> = suspend () -> T

Suspending initializer of a value.

Link copied to clipboard
interface SuspendLazy<out T>

Similar to Lazy but for suspend functions.

Functions

Link copied to clipboard
suspend fun <T> blocking(block: suspend CoroutineScope.() -> T): T

Makes an "inappropriate blocking method call" appropriate.

Link copied to clipboard
suspend fun <T> Iterable<T>.forEachParallel(action: suspend (T) -> Unit)

Performs action on each element of this Iterable in parallel. Suspends until all spawned child coroutines are done.

Link copied to clipboard
Link copied to clipboard
suspend fun <T> Iterable<T>.onEachParallel(action: suspend T.() -> Unit)

Version of forEachParallel using a lambda-with-receiver instead.

Link copied to clipboard
suspend fun <T, S> Collection<T>.parallelMap(maxConcurrentRequests: Int? = null, mapper: suspend (T) -> S): List<S>

Maps every element of this collection using mapper in parallel.

Link copied to clipboard
suspend fun <T, S> Collection<T>.parallelMapIndexed(maxConcurrentRequests: Int? = null, mapper: suspend (index: Int, T) -> S): List<S>

Maps every element of this collection using mapper in parallel.

Link copied to clipboard
suspend fun <T, S> Collection<T>.parallelMapNotNull(maxConcurrentRequests: Int? = null, mapper: suspend (T) -> S?): List<S>

Maps every element of this collection using mapper in parallel and filters out null.

Link copied to clipboard
suspend fun <T, S> Collection<T>.parallelMapNotNullIndexed(maxConcurrentRequests: Int? = null, mapper: suspend (index: Int, T) -> S?): List<S>

Maps every element of this collection using mapper in parallel and filters out null.

Link copied to clipboard
expect fun <T> suspendLazy(initializer: SuspendingInitializer<T>): SuspendLazy<T>

Creates the default SuspendLazy implementation, behavior might be different based on platform.

Creates a SuspendLazy implementation corresponding to mode, please refer to the platform documentation for how mode is being used.

actual fun <T> suspendLazy(initializer: SuspendingInitializer<T>): SuspendLazy<T>

Creates a SuspendLazy implementation using LazyThreadSafetyMode.NONE as JS doesn't provide thread safety.

actual fun <T> suspendLazy(initializer: SuspendingInitializer<T>): SuspendLazy<T>

Creates a SuspendLazy implementation using LazyThreadSafetyMode.SYNCHRONIZED.

Creates a SuspendLazy implementation using mode.

actual fun <T> suspendLazy(initializer: SuspendingInitializer<T>): SuspendLazy<T>

Creates a SuspendLazy implementation using LazyThreadSafetyMode.SYNCHRONIZED as JS doesn't provide thread safety.

Creates a SuspendLazy implementation using mode as JS doesn't provide thread safety.