Package-level declarations

Utilities for the Outcome type, allowing to embed typed error management directly into the API without using exceptions.

Types

Link copied to clipboard
sealed class Outcome<out Failure, out Value>

The result of an operation.

Properties

Link copied to clipboard
Link copied to clipboard

Returns Failure.failure, or null if this outcome is not a failure.

Link copied to clipboard
Link copied to clipboard

Returns Success.value, or null if this outcome is not successful.

Functions

Link copied to clipboard
Link copied to clipboard

If this outcome is successful, replaces its value using transform.

Link copied to clipboard

If this outcome is failed, replaces its failure using transformFailure.

Link copied to clipboard
inline fun <Failure> Outcome<Failure, *>.onFailure(block: (Failure) -> Unit)

Executes block if this outcome is a failure.

Link copied to clipboard
inline fun <Value> Outcome<*, Value>.onSuccess(block: (Value) -> Unit)

Executes block if this outcome is successful.

Link copied to clipboard