OptionInspect

Trait OptionInspect 

Source
pub trait OptionInspect<F, T>
where F: FnOnce(&T), T: Sized,
{ // Required method fn inspect(self, f: F) -> Self; }
Expand description

Extension trait for adding Option::inspect

Required Methods§

Source

fn inspect(self, f: F) -> Self

Inspect the Option

Either call f on the value in Some or do nothing if this Option is a None.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<F, T> OptionInspect<F, T> for Option<T>
where F: FnOnce(&T), T: Sized,

Source§

fn inspect(self, f: F) -> Self

Implementors§