zip

open fun <A, B, R> Result<A>.zip(other: Result<B>, combine: (A, B) -> R): Result<R>

Convenience to join two Results into one, forwarding loading and error states, and mapping the combination to another Result.

Parameters

other

The other Result to combine with.

combine

The mapping function to apply to the two values, e.g. into a Pair with { a, b -> a to b }.


open fun <A, B> Result<A>.zip(other: Result<B>): Result<Pair<A, B>>

Convenience to join two Results into one, forwarding loading and error states, and mapping the combination to a Pair.

Parameters

other

The other Result to combine with.