nullableOf

inline fun <T : Any> nullableOf(block: RaiseScope<Unit>.() -> T): T?

Context runner that uses RaiseScope to safely capture raised or thrown errors, and unwraps either the successful Outcome or null.

Used in scenarios where you want the advantages of Outcome, but immediately resolve to its Ok type or null.

Return

The result of the block if successful, or null if an error occurs.

Parameters

block

The code to execute within the RaiseScope.


inline fun <In, Out : Any> In.nullableOf(block: RaiseScope<Unit>.(In) -> Out): Out?

Context runner that uses RaiseScope to safely capture raised or thrown errors, and unwraps either the successful Outcome or null.

Used in scenarios where you want the advantages of Outcome, but immediately resolve to its Ok type or null.

Receiver

Some input type, In, passed to block.

Return

The result of the block if successful, or null if an error occurs.

Parameters

block

The code to execute within the RaiseScope.