toResultOr

infix inline fun <V, E> V?.toResultOr(error: () -> E): Result<V, E>

Converts a nullable of type V to a Result. Returns Ok if the value is non-null, otherwise the supplied error.