Trait OptionExt

Source
pub trait OptionExt<T> {
    // Required methods
    fn is_none_or<F>(&self, f: F) -> bool
       where F: FnOnce(&T) -> bool;
    fn map_ref<U, F>(&self, f: F) -> Option<U>
       where F: FnOnce(&T) -> U;
}
Expand description

Extension trait for Option types

Required Methods§

Source

fn is_none_or<F>(&self, f: F) -> bool
where F: FnOnce(&T) -> bool,

Source

fn map_ref<U, F>(&self, f: F) -> Option<U>
where F: FnOnce(&T) -> U,

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

Source§

fn is_none_or<F>(&self, f: F) -> bool
where F: FnOnce(&T) -> bool,

Source§

fn map_ref<U, F>(&self, f: F) -> Option<U>
where F: FnOnce(&T) -> U,

Implementors§