5 /// Returns `Some(t)` if the `bool` is `true`, or `None` otherwise.
10 /// #![feature(bool_to_option)]
12 /// assert_eq!(false.then(0), None);
13 /// assert_eq!(true.then(0), Some(0));
15 #[unstable(feature = "bool_to_option", issue = "64260")]
17 pub fn then<T>(self, t: T) -> Option<T> {
25 /// Returns `Some(f())` if the `bool` is `true`, or `None` otherwise.
30 /// #![feature(bool_to_option)]
32 /// assert_eq!(false.then_with(|| 0), None);
33 /// assert_eq!(true.then_with(|| 0), Some(0));
35 #[unstable(feature = "bool_to_option", issue = "64260")]
37 pub fn then_with<T, F: FnOnce() -> T>(self, f: F) -> Option<T> {