Trait respector::prelude::OptionInspector [−][src]
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.