Enum tear::Moral[][src]

pub enum Moral<Y, N> {
    Good(Y),
    Bad(N),
}

A notion of good and bad for the terror! macro

Variants

Good(Y)

The good

Bad(N)

And the bad

Implementations

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

pub fn good(self) -> Option<Y>[src]

Gets the Good(Y) variant as Option<Y>

pub fn bad(self) -> Option<N>[src]

Gets the Bad(N) variant as Option<N>

pub fn into_valret(self) -> ValRet<Y, N>[src]

Convert to ValRet

Maps Good to Val and Bad to Ret.

pub fn into_result(self) -> Result<Y, N>[src]

Convert to Result. Use Judge::result instead

Maps Good to Ok and Bad to Err.

pub fn resume_or_else<B>(
    self,
    f: impl FnOnce(N) -> Looping<Y, B>
) -> Looping<Y, B>
[src]

(dev) Convert to a Looping by mapping Good to Resume, and Bad through a function

The function f takes the bad value and maps it to a Looping value.

Used in the twist! macro with the mapping (=>) syntax. See twist! documentation.

Trait Implementations

impl<Y: Clone, N: Clone> Clone for Moral<Y, N>[src]

impl<Y: Debug, N: Debug> Debug for Moral<Y, N>[src]

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

type Positive = Y

This is considered Good

type Negative = N

This is considered Bad

impl<Y: PartialEq, N: PartialEq> PartialEq<Moral<Y, N>> for Moral<Y, N>[src]

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

Auto Trait Implementations

impl<Y, N> Send for Moral<Y, N> where
    N: Send,
    Y: Send

impl<Y, N> Sync for Moral<Y, N> where
    N: Sync,
    Y: Sync

impl<Y, N> Unpin for Moral<Y, N> where
    N: Unpin,
    Y: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, E, Me> Return for Me where
    Me: Judge<Positive = T, Negative = E>, 
[src]

type Value = T

The Val in ValRet

type Returned = E

The Ret in ValRet

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.