Package-level declarations

Functions

Link copied to clipboard
inline fun <In, Out> ResultFlow<In>.andThen(crossinline success: suspend (In) -> Out): Flow<Result<Out>>

Returns a flow containing the output of applying KotlinResult.andThen to each value of the original flow.

inline fun <T> ResultFlow<T>.andThen(crossinline predicate: (T) -> Boolean, crossinline success: suspend (T) -> T): Flow<Result<T>>

Returns a flow containing the Out of applying KotlinResult.andIf to each value of the original flow.

Link copied to clipboard

Returns a flow containing only failed values of the original flow.

Link copied to clipboard
fun <T> ResultFlow<T>.filterSuccess(): Flow<T>

Returns a flow containing only successful values of the original flow.

Link copied to clipboard

Returns a flow that KotlinResult.flatten a nested KotlinResult for each value of the original flow.

Link copied to clipboard
inline fun <In, Out> ResultFlow<In>.foldResult(crossinline success: suspend (In) -> Out, crossinline failure: suspend (Throwable) -> Out): Flow<Out>

Returns a flow containing the output of applying KotlinResult.fold to each value of the original flow.

Link copied to clipboard
inline fun <T> ResultFlow<T>.mapFailure(crossinline failure: suspend (Throwable) -> Throwable): Flow<Result<T>>

Returns a flow containing the output of applying KotlinResult.mapFailure to each value of the original flow.

Link copied to clipboard
inline fun <In, Out> ResultFlow<In>.mapSuccess(crossinline success: suspend (In) -> Out): Flow<Result<Out>>

Returns a flow containing the output of applying KotlinResult.map to each value of the original flow.

Link copied to clipboard
inline fun <T> ResultFlow<T>.onEachFailure(crossinline action: suspend (Throwable) -> Unit): ResultFlow<T>

Returns a flow that invokes the given action if it is a failure before each value of the upstream flow is emitted downstream.

Link copied to clipboard
inline fun <T> ResultFlow<T>.onEachResult(crossinline success: suspend (T) -> Unit, crossinline failure: suspend (Throwable) -> Unit): ResultFlow<T>

Returns a flow that invokes the given actions for each success and failure before each value of the upstream flow is emitted downstream.

Link copied to clipboard
inline fun <T> ResultFlow<T>.onEachSuccess(crossinline action: suspend (T) -> Unit): ResultFlow<T>

Returns a flow that invokes the given action if it is a success before each value of the upstream flow is emitted downstream.

Link copied to clipboard
suspend fun <In, Out> Iterable<KotlinResult<In>>.parallelAndThen(success: suspend CoroutineScope.(In) -> Out): List<KotlinResult<Out>>

Parallel KotlinResult.andThen of multiple KotlinResults. Each result is processed in a separate coroutine, and the results are collected as a List of KotlinResult.

suspend fun <In, Out> Sequence<KotlinResult<In>>.parallelAndThen(success: suspend CoroutineScope.(In) -> Out): List<KotlinResult<Out>>

Parallel KotlinResult.andThen of multiple KotlinResults. Each result is processed in a separate coroutine, and the results are collected as a Sequence of Deferred KotlinResult.

Link copied to clipboard
suspend fun <In, Out> Iterable<KotlinResult<In>>.parallelFold(success: suspend CoroutineScope.(In) -> Out, failure: suspend CoroutineScope.(Throwable) -> Out): List<Out>

Parallel KotlinResult.fold of multiple KotlinResults. Each result is processed in a separate coroutine, and the results are collected as a List of Out.

suspend fun <In, Out> Sequence<KotlinResult<In>>.parallelFold(success: suspend CoroutineScope.(In) -> Out, failure: suspend CoroutineScope.(Throwable) -> Out): List<Out>

Parallel KotlinResult.fold of multiple KotlinResults. Each result is processed in a separate coroutine, and the results are collected as a Sequence of Deferred Out.

Link copied to clipboard
suspend fun <T> Iterable<suspend CoroutineScope.() -> T>.parallelResult(): List<KotlinResult<T>>

Parallel execution of multiple resultOf lambdas. Each lambda is executed in a separate coroutine, and the results are collected as a List of KotlinResult.

suspend fun <T> Sequence<suspend CoroutineScope.() -> T>.parallelResult(): List<KotlinResult<T>>

Parallel execution of multiple resultOf lambdas. Each lambda is executed in a separate coroutine, and the results are collected as a sequence of Deferred Results.

Link copied to clipboard
suspend fun <T> parallelResultOf(vararg blocks: suspend CoroutineScope.() -> T): List<KotlinResult<T>>

Parallel execution of multiple resultOf lambdas. Each lambda is executed in a separate coroutine, and the results are collected as a List of KotlinResult.

Link copied to clipboard
suspend fun <T> Iterable<KotlinResult<T>>.parallelTryRecover(failure: suspend CoroutineScope.(Throwable) -> T): List<KotlinResult<T>>

Parallel KotlinResult.tryRecover of multiple KotlinResults. Each result is processed in a separate coroutine, and the results are collected as a List of KotlinResult.

suspend fun <T> Sequence<KotlinResult<T>>.parallelTryRecover(failure: suspend CoroutineScope.(Throwable) -> T): List<KotlinResult<T>>

Parallel KotlinResult.tryRecover of multiple KotlinResults. Each result is processed in a separate coroutine, and the results are collected as a Sequence of Deferred KotlinResult.

Link copied to clipboard
inline fun <T> ResultFlow<T>.tryRecover(crossinline failure: suspend (Throwable) -> T): Flow<Result<T>>

Returns a flow containing the output of applying KotlinResult.tryRecover to each value of the original flow.