Trait enso_prelude::OptionOps[][src]

pub trait OptionOps {
    type Item;
    fn map_none<F>(self, f: F) -> Self
    where
        F: FnOnce()
;
fn map_ref<U, F>(&self, f: F) -> Option<U>
    where
        F: FnOnce(&Self::Item) -> U
;
fn for_each<U, F>(self, f: F)
    where
        F: FnOnce(Self::Item) -> U
;
fn for_each_ref<U, F>(&self, f: F)
    where
        F: FnOnce(&Self::Item) -> U
;
fn contains_if<F>(&self, f: F) -> bool
    where
        F: FnOnce(&Self::Item) -> bool
; }
Expand description

Adds mapping methods to the Option type.

Associated Types

Loading content...

Required methods

fn map_none<F>(self, f: F) -> Self where
    F: FnOnce(), 
[src]

fn map_ref<U, F>(&self, f: F) -> Option<U> where
    F: FnOnce(&Self::Item) -> U, 
[src]

fn for_each<U, F>(self, f: F) where
    F: FnOnce(Self::Item) -> U, 
[src]

fn for_each_ref<U, F>(&self, f: F) where
    F: FnOnce(&Self::Item) -> U, 
[src]

fn contains_if<F>(&self, f: F) -> bool where
    F: FnOnce(&Self::Item) -> bool
[src]

Expand description

Returns true if option contains Some with value matching given predicate.

Loading content...

Implementations on Foreign Types

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

type Item = T

fn map_none<F>(self, f: F) -> Self where
    F: FnOnce(),
    T: Sized
[src]

fn map_ref<U, F>(&self, f: F) -> Option<U> where
    F: FnOnce(&Self::Item) -> U, 
[src]

fn for_each<U, F>(self, f: F) where
    F: FnOnce(Self::Item) -> U, 
[src]

fn for_each_ref<U, F>(&self, f: F) where
    F: FnOnce(&Self::Item) -> U, 
[src]

fn contains_if<F>(&self, f: F) -> bool where
    F: FnOnce(&Self::Item) -> bool
[src]

Loading content...

Implementors

Loading content...