OptionUnwrap<T> extension
Extraction with a fallback on Option.
An extension rather than members of Option, so the fallback's type comes
from the static type at the call site. As members they were checked against
the type a value was built with, and a None<int>() held in an
Option<num> threw a TypeError for a double fallback.
- on
-
- Option<
T>
- Option<
Methods
-
unwrapOr(
T fallback) → T -
Available on Option<
Returns the present value, orT> , provided by the OptionUnwrap extensionfallbackwhen this option is absent. -
unwrapOrElse(
T fallback()) → T -
Available on Option<
Returns the present value, or computes one when this option is absent.T> , provided by the OptionUnwrap extension