Trait respector::prelude::OptionInspector[][src]

pub trait OptionInspector<T> {
    fn inspect<F: FnMut(&T)>(self, f: F) -> Option<T>;
}

Required methods

fn inspect<F: FnMut(&T)>(self, f: F) -> Option<T>[src]

Does something with the contained Some value element of an Option, passing the value on.

Examples

use respector::prelude::*;

let (some, none) = (Some(10), None::<i32>);
assert_eq!(some.inspect(|x| println!("Some({})", x)), some); // Prints `Some(10)`.
assert_eq!(none.inspect(|x| println!("Some({})", x)), none); // Prints nothing.
Loading content...

Implementations on Foreign Types

impl<T> OptionInspector<T> for Option<T>[src]

Loading content...

Implementors

Loading content...