Option$NoneExtension<T> extension
Option methods that could not be added to the main Option class.
Dev Note: This is because things like option.xor(Some(..))
, where option
is really a None
,
would cause runtime exceptions since it was valid code, but Some
- on
-
- Option<
T>
- Option<
Methods
-
or(
Option< T> other) → Option<T> -
Available on Option<
Returns the option if it contains a value, otherwise returnsT> , provided by the Option$NoneExtension extensionother
-
orElse(
Option< T> f()) → Option<T> -
Available on Option<
Returns the option if it contains a value, otherwise calls f and returns the result.T> , provided by the Option$NoneExtension extension -
unwrapOr(
T defaultValue) → T -
Available on Option<
Returns the contained Some value or a provided default.T> , provided by the Option$NoneExtension extension -
unwrapOrElse(
T f()) → T -
Available on Option<
Returns the option if it contains a value, otherwise returns other.T> , provided by the Option$NoneExtension extension -
xor(
Option< T> other) → Option<T> -
Available on Option<
Returns Some if exactly one of this orT> , provided by the Option$NoneExtension extensionother
is Some, otherwise returns None.