[][src]Trait tear::Judge

pub trait Judge {
    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; }

Convert from and to Moral. Used in the rip! macro.

This is inspired by the std::ops::Try trait.

Associated Types

type Positive

This is considered Good

type Negative

This is considered Bad

Loading content...

Required methods

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

Convert to Moral

fn from_good(v: Self::Positive) -> Self

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

Wraps a bad value into itself

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

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 = ()

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<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...