OneOf2

sealed interface OneOf2<out T1, out T2> : OneOf(source)

Two-way discriminated union.

Inheritors

Types

Link copied to clipboard
value class Option1<T>(val value: T) : OneOf2<T, Nothing>

Represents the first alternative of the union. @property value payload chosen for the first branch.

Link copied to clipboard
value class Option2<T>(val value: T) : OneOf2<Nothing, T>

Represents the second alternative of the union. @property value payload chosen for the second branch.

Functions

Link copied to clipboard
open fun <R> select(when1: (T1) -> R, when2: (T2) -> R): R

Exhaustively handles the stored value by delegating to the matching lambda.