Trait tear::Judge[][src]

pub trait Judge: Sized {
    type Positive;
    type Negative;
    fn into_moral(self) -> Moral<Self::Positive, Self::Negative>;
fn from_good(v: Self::Positive) -> Self;
fn from_bad(v: Self::Negative) -> Self; fn result(self) -> Result<Self::Positive, Self::Negative> { ... } }

Convert from and to Moral. Used for the macro map syntax.

This mirrors the ops::Try trait.

It is used for the => mapping syntax of macros, to differentiate the value we want to keep from the value we want to map through the function.

Associated Types

type Positive[src]

This is considered Good

type Negative[src]

This is considered Bad

Loading content...

Required methods

fn into_moral(self) -> Moral<Self::Positive, Self::Negative>[src]

Convert to Moral

fn from_good(v: Self::Positive) -> Self[src]

Wraps a good value into itself

For example Result::Ok(v) and Judge::from_good(v) are equivalent. Useful for converting types.

fn from_bad(v: Self::Negative) -> Self[src]

Wraps a bad value into itself

For example Result::Err(e) and Judge::from_bad(e) are equivalent. Useful for converting types.

Loading content...

Provided methods

fn result(self) -> Result<Self::Positive, Self::Negative>[src]

Convert to result

Loading content...

Implementations on Foreign Types

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

Implementation of Judge for Option based on its implementation of Try

type Positive = T

type Negative = Maru

impl<T, E> Judge for Result<T, E>[src]

Implementation of Judge for Result based on its implementation of Try

type Positive = T

type Negative = E

Loading content...

Implementors

impl Judge for bool[src]

type Positive = Maru

type Negative = Maru

impl<T, R> Judge for ValRet<T, R>[src]

type Positive = T

type Negative = R

impl<Y, N> Judge for Moral<Y, N>[src]

type Positive = Y

type Negative = N

Loading content...