Trait map_for::Filter
[−]
[src]
pub trait Filter<Item> { type Item; fn filter<P>(self, predicate: P) -> Option<Item>
where
P: FnOnce(&Self::Item) -> bool; }
This trait creates a filter
method for Option
so that it can be
filtered on when used in the map_for
macro.
Example:
use map_for::{ Filter, FlatMap }; let c = map_for!{ a <- Some (1); if (a%2) == 0; b <- Some (2); => { a + b } }; assert_eq!(c, None);