OptionExt

Trait OptionExt 

Source
pub trait OptionExt<T> {
    // Required methods
    fn unwrap_logic(self) -> T;
    fn and_then_logic<U>(self, f: Mapping<T, Option<U>>) -> Option<U>;
    fn map_logic<U>(self, f: Mapping<T, U>) -> Option<U>;
}

Required Methods§

Source

fn unwrap_logic(self) -> T

Same as Option::unwrap, but in logic.

requires

false

Source

fn and_then_logic<U>(self, f: Mapping<T, Option<U>>) -> Option<U>

Same as Option::and_then, but in logic.

Source

fn map_logic<U>(self, f: Mapping<T, U>) -> Option<U>

Same as Option::map, but in logic.

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 unwrap_logic(self) -> T

(open)

match self {
    Some(x) => x,
    None => such_that(|_| true),
}

requires

self != None

Source§

fn and_then_logic<U>(self, f: Mapping<T, Option<U>>) -> Option<U>

(open)

match self {
    None => None,
    Some(x) => f.get(x),
}
Source§

fn map_logic<U>(self, f: Mapping<T, U>) -> Option<U>

(open)

match self {
    None => None,
    Some(x) => Some(f.get(x)),
}

Implementors§