AptosResult

sealed interface AptosResult<out T>

The public, typed outcome of a Kaptos operation.

Inheritors

Types

Link copied to clipboard
data class Failure(val error: AptosError) : AptosResult<Nothing>
Link copied to clipboard
data class Success<out T>(val value: T) : AptosResult<T>

Properties

Link copied to clipboard
open val isFailure: Boolean
Link copied to clipboard
open val isSuccess: Boolean

Functions

Link copied to clipboard

Returns the failure, or null for success.

Link copied to clipboard
inline fun <T, R> AptosResult<T>.flatMap(transform: (T) -> AptosResult<R>): AptosResult<R>

Chains another typed Aptos operation after a successful value.

Link copied to clipboard
inline fun <T, R> AptosResult<T>.fold(onSuccess: (T) -> R, onFailure: (AptosError) -> R): R

Reduces either branch to one caller-defined result type.

Link copied to clipboard
inline fun <T> AptosResult<T>.getOrElse(defaultValue: (AptosError) -> T): T

Returns the success value or derives a fallback from the typed error.

Link copied to clipboard

Returns the success value, or null for a failure.

Link copied to clipboard
inline fun <T, R> AptosResult<T>.map(transform: (T) -> R): AptosResult<R>

Transforms a successful value while retaining a failure unchanged.

Link copied to clipboard
inline fun <T> AptosResult<T>.onFailure(action: (AptosError) -> Unit): AptosResult<T>

Performs action for failure and returns this result unchanged.

Link copied to clipboard
inline fun <T> AptosResult<T>.onSuccess(action: (T) -> Unit): AptosResult<T>

Performs action for success and returns this result unchanged.