Option

class guppylang.std.option.Option[source]

Represents an optional value.

is_nothing() bool[source]

Returns True if the option is a nothing value.

is_some() bool[source]

Returns True if the option is a some value.

swap(other: Option[L]) Option[L][source]

Swaps the value of self with other and returns the original value.

take() Option[L][source]

Swaps the value of self with nothing and returns the original value.

unwrap() T[source]

Returns the contained some value, consuming self.

Panics if the option is a nothing value.

unwrap_nothing() None[source]

Returns None if the option is a nothing value, consuming self.

Panics if the option is a some value.