Option::map_or
pub fn map_or<U>(U fallback, T -> U f) -> U
Source: compiler/src/prelude/core.hy f(value), or fallback when None.
Called on a Option value as value.map_or(…).
Parameters#
| Name | Type |
|---|---|
fallback | U |
f | T -> U |
Returns#
U
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::and_then:f(value)(itself anOption), orNone.Option::or: This option if it isSome, otherwiseother.