Result

sealed class Result<out T>

Inheritors

Constructors

Link copied to clipboard
protected constructor()

Types

Link copied to clipboard
data class Error(val exception: Throwable) : Result<Nothing>
Link copied to clipboard
data class Success<out T>(val data: T) : Result<T>

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
inline fun <R> flatMap(transform: (T) -> Result<R>): Result<R>
Link copied to clipboard
inline fun <T, R> Result<T>.fold(onError: (Throwable) -> R, onSuccess: (T) -> R): R
Link copied to clipboard
inline fun <T> Result<T>.getOrElse(defaultValue: () -> T): T
Link copied to clipboard
fun getOrNull(): T?
Link copied to clipboard
fun getOrThrow(): T
Link copied to clipboard
inline fun <R> map(transform: (T) -> R): Result<R>
Link copied to clipboard
inline fun <T, R> Result<T>.mapError(transform: (Throwable) -> Throwable): Result<R>
Link copied to clipboard
inline fun onError(action: (Throwable) -> Unit): Result<T>
Link copied to clipboard
inline fun onSuccess(action: (T) -> Unit): Result<T>
Link copied to clipboard