Mark on{Success,Failure} as infix
This commit is contained in:
parent
5dc5d3680e
commit
3e3b649193
@ -4,10 +4,10 @@ package com.github.michaelbull.result
|
||||
* Calls a [callback] if the [Result] is [Ok].
|
||||
* @param callback The function to call.
|
||||
*/
|
||||
inline fun <V, E> Result<V, E>.onSuccess(callback: (V) -> Unit) = mapBoth(callback, {})
|
||||
infix inline fun <V, E> Result<V, E>.onSuccess(callback: (V) -> Unit) = mapBoth(callback, {})
|
||||
|
||||
/**
|
||||
* Calls a [callback] if the [Result] is [Err].
|
||||
* @param callback The function to call.
|
||||
*/
|
||||
inline fun <V, E> Result<V, E>.onFailure(callback: (E) -> Unit) = mapBoth({}, callback)
|
||||
infix inline fun <V, E> Result<V, E>.onFailure(callback: (E) -> Unit) = mapBoth({}, callback)
|
||||
|
Loading…
Reference in New Issue
Block a user