[−][src]Trait kai::BoolMap
Maps bool
s to Option
s in one line
Example
use kai::*; let condition = true; // Turn this: let s = if condition { Some(String::new()) } else { None }; // Into this: let s = condition.map_with(String::new); assert_eq!(Some(String::new()), s);
Required methods
fn map<T>(self, value: T) -> Option<T>
Map to an optional value
fn map_with<T, F>(self, f: F) -> Option<T> where
F: FnMut() -> T,
F: FnMut() -> T,
Map to an optional value using a function