[][src]Trait intoif::IntoOption

pub trait IntoOption where
    Self: Sized
{ fn some_if<P>(self, predicate: P) -> Option<Self>
    where
        P: FnOnce(&Self) -> bool
, { ... }
fn none_if<P>(self, predicate: P) -> Option<Self>
    where
        P: FnOnce(&Self) -> bool
, { ... } }

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, 

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, 

Returns None if predicate returns true on self, Some(self) otherwise.

Loading content...

Implementors

impl<T> IntoOption for T[src]

Loading content...