foldSuspend

inline suspend fun <R, T> Result<T>.foldSuspend(crossinline onSuccess: suspend (value: T) -> R, crossinline onFailure: suspend (exception: Throwable) -> R): R

Author

skydoves (Jaewoong Eum)

Since

1.0.1

Returns the result of onSuccess for the encapsulated value if this instance represents success or the result of onFailure suspend function for the encapsulated Throwable exception if it is failure.

Note, that this function rethrows any Throwable exception thrown by onSuccess or by onFailure function.