toOutcome

fun <Ok, Error> Ok.toOutcome(predicate: Ok.() -> Boolean, faulter: Ok.() -> Error): Outcome<Ok, Error>

Wraps this value as an Outcome based on a predicate.

Parameters

Ok

The type of the value to wrap.

Error

The error type produced by faulter.

predicate

Determines whether the value represents success.

faulter

Produces the Failure error when predicate is false. Called at most once.


Smart-wraps any T as an Outcome.

Use asSuccess or asFailure for direct wrapping without type inference.

Parameters

T

The type of the value to wrap.