mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-27 03:49:04 +03:00
Simple code
This commit is contained in:
parent
dafdc1d3ad
commit
1462fa0484
1 changed files with 8 additions and 0 deletions
|
@ -31,3 +31,11 @@ inline fun <A> TryOf<A>.onError(f: (Throwable) -> Unit): Try<A> = fix()
|
|||
fun <A> Try<A>.foldToCallback(callback: MatrixCallback<A>): Unit = fold(
|
||||
{ callback.onFailure(it) },
|
||||
{ callback.onSuccess(it) })
|
||||
|
||||
/**
|
||||
* Same as doOnNext for Observables
|
||||
*/
|
||||
inline fun <A> Try<A>.alsoDo(f: (A) -> Unit) = map {
|
||||
f(it)
|
||||
it
|
||||
}
|
Loading…
Reference in a new issue