[−][src]Trait intoif::IntoOption
Allow construction of Option
from any type using predicate to choose between Some
and None
.
Provided methods
fn some_if<P>(self, predicate: P) -> Option<Self> where
P: FnOnce(&Self) -> bool,
P: FnOnce(&Self) -> bool,
Returns Some(self)
if predicate returns true on self, None
otherwise.
fn none_if<P>(self, predicate: P) -> Option<Self> where
P: FnOnce(&Self) -> bool,
P: FnOnce(&Self) -> bool,
Returns None
if predicate returns true on self, Some(self)
otherwise.