Success
Represents a successful KResult
Empty Success
An empty success, e.g. an action that can fail or be successful but doesn't return any value, can be represented using:
import io.kresult.core.KResult
import io.kotest.matchers.shouldBe
fun test() {
val res: KResult<Nothing, Unit> =
KResult.Success.unit
res.isSuccess() shouldBe true
}
Content copied to clipboard
Functions
Link copied to clipboard
Failure component for destructuring declaration
Link copied to clipboard
Success component for destructuring declaration
Link copied to clipboard
Runs the Failure.error, if the KResult is a failure or null
otherwise
Link copied to clipboard
Runs the Success.value, if the KResult is a success or null
otherwise
Link copied to clipboard
If a KResult has a Throwable on failure side, this either returns the Success.value or throws the Failure.error
Link copied to clipboard