Add Rust reference comments for on{Success,Failure}

This commit is contained in:
Michael Bull 2024-03-02 16:39:14 +00:00
parent 05d50b7fec
commit 73a71154e9

View File

@ -5,6 +5,8 @@ import kotlin.contracts.contract
/**
* Invokes an [action] if this [Result] is [Ok].
*
* - Rust: [Result.inspect](https://doc.rust-lang.org/std/result/enum.Result.html#method.inspect)
*/
public inline infix fun <V, E> Result<V, E>.onSuccess(action: (V) -> Unit): Result<V, E> {
contract {
@ -20,6 +22,8 @@ public inline infix fun <V, E> Result<V, E>.onSuccess(action: (V) -> Unit): Resu
/**
* Invokes an [action] if this [Result] is [Err].
*
* - Rust [Result.inspect_err](https://doc.rust-lang.org/std/result/enum.Result.html#method.inspect_err)
*/
public inline infix fun <V, E> Result<V, E>.onFailure(action: (E) -> Unit): Result<V, E> {
contract {