fold

inline fun <R, T> Resultat<T>.fold(    onSuccess: (value: T) -> R,     onFailure: (exception: Throwable) -> R,     onLoading: () -> R): R

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

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