Option::or_else
pub fn or_else(fn() -> Option<T> f) -> Option<T>
Source: compiler/src/prelude/core.hy This option if it is Some, otherwise the result of f.
Called on a Option value as value.or_else(…).
Parameters#
| Name | Type |
|---|---|
f | fn() -> Option<T> |
Returns#
Option<T>
See also#
OptionOption::is_some: True when this isSome.Option::is_none: True when this isNone.Option::unwrap_or: The value, orfallbackwhenNone.Option::unwrap_or_else: The value, or the result offwhenNone.Option::map:Some(f(value)), orNone.Option::map_or:f(value), orfallbackwhenNone.Option::and_then:f(value)(itself anOption), orNone.