[][src]Trait mod_utilities::AllowIf

pub trait AllowIf: Sized {
    type Accepted;
    fn allow_if<F: FnOnce(&Self::Accepted) -> bool>(
        self,
        f: F
    ) -> Option<Self::Accepted>;
fn allow_if_mut<F: FnOnce(&mut Self::Accepted) -> bool>(
        self,
        f: F
    ) -> Option<Self::Accepted>; fn allow_if_not<F: FnOnce(&Self::Accepted) -> bool>(
        self,
        f: F
    ) -> Option<Self::Accepted> { ... }
fn allow_if_not_mut<F: FnOnce(&mut Self::Accepted) -> bool>(
        self,
        f: F
    ) -> Option<Self::Accepted> { ... } }

A trait that allows discarding Option values if some condition is or is not met

Associated Types

type Accepted

The type of value given by AllowIf calls

Loading content...

Required methods

fn allow_if<F: FnOnce(&Self::Accepted) -> bool>(
    self,
    f: F
) -> Option<Self::Accepted>

Discard Option value if some condition is not met

fn allow_if_mut<F: FnOnce(&mut Self::Accepted) -> bool>(
    self,
    f: F
) -> Option<Self::Accepted>

Discard Option value if some condition is not met

Loading content...

Provided methods

fn allow_if_not<F: FnOnce(&Self::Accepted) -> bool>(
    self,
    f: F
) -> Option<Self::Accepted>

Discard Option value if some condition is met

fn allow_if_not_mut<F: FnOnce(&mut Self::Accepted) -> bool>(
    self,
    f: F
) -> Option<Self::Accepted>

Discard Option value if some condition is met

Loading content...

Implementations on Foreign Types

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

type Accepted = T

Loading content...

Implementors

Loading content...