Function map_w_default

Source
pub fn map_w_default<S, F>(s: S, f: F) -> Map<S, F, ConstTrue>
Expand description

Same as map, but allows access to data_or_default methods.

§Map function

Your function MUST preserve the default value when it appears as input. You’re allowed to change its type, but it must be semantically default value. Like &0 -> 0, (&0, &0) -> 0, 0 -> None, etc.