Mark on{Success,Failure} as infix

This commit is contained in:
Michael Bull 2017-12-16 22:30:04 +00:00
parent 5dc5d3680e
commit 3e3b649193

View File

@ -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)