Rust · Method
Option::map
Option::map transforms the value inside Some and leaves None unchanged. It returns another Option, so optional control flow can be chained.
Last updated
- Since
- 1.0.0
Syntax
pub fn map<U, F>(self, f: F) -> Option<U>
where
F: FnOnce(T) -> UIn-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
OptionOption::map_orOption::map_or_elseclosuresand_then