OptionExt

Trait OptionExt 

Source
pub trait OptionExt {
    type Item;

    // Required method
    fn take_if<F>(&mut self, fun: F) -> Option<Self::Item>
       where F: FnOnce(&Self::Item) -> bool;
}
Expand description

Various extensions to Option.

Required Associated Types§

Source

type Item

The item type inside the Option.

Required Methods§

Source

fn take_if<F>(&mut self, fun: F) -> Option<Self::Item>
where F: FnOnce(&Self::Item) -> bool,

Take the value of self only if the given condition is true.

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<T> OptionExt for Option<T>

Source§

type Item = T

Source§

fn take_if<F>(&mut self, fun: F) -> Option<Self::Item>
where F: FnOnce(&Self::Item) -> bool,

Implementors§