Either

class guppylang.std.either.Either[source]

Represents a union of either a left or a right value.

is_left() bool[source]

Returns True for a left value.

is_right() bool[source]

Returns True for a right value.

try_into_left() Option[L][source]

Returns the wrapped value if self is a left value, or nothing otherwise.

This operation is only allowed if the right variant wraps a droppable type.

try_into_right() Option[R][source]

Returns the wrapped value if self is a right value, or nothing otherwise.

This operation is only allowed if the left variant wraps a droppable type.

unwrap_left() L[source]

Returns the contained left value, consuming self.

Panics if self is a right value.

unwrap_right() R[source]

Returns the contained right value, consuming self.

Panics if self is a left value.