[][src]Trait truthy::Truthy

pub trait Truthy {
    fn truthy(&self) -> bool;

    fn falsy(&self) -> bool { ... }
fn truthy_or<T>(self, other: T) -> Either<Self, T>
    where
        Self: Sized
, { ... }
fn truthy_and<T>(self, other: T) -> Option<T>
    where
        Self: Sized
, { ... } }

Convert to a bool.

Required methods

fn truthy(&self) -> bool

Converts &self to a bool.

Loading content...

Provided methods

fn falsy(&self) -> bool

Not truthy

fn truthy_or<T>(self, other: T) -> Either<Self, T> where
    Self: Sized

Left(self) if self is truthy, else Right(other)

assert_eq!(true.truthy_or('t').left(), Some(true));
assert_eq!(false.truthy_or('t').right(), Some('t'));

fn truthy_and<T>(self, other: T) -> Option<T> where
    Self: Sized

Some(other) if self is truthy, else None

assert_eq!(true.truthy_and('t'), Some('t'));
assert_eq!(false.truthy_and('t'), None);
Loading content...

Implementations on Foreign Types

impl Truthy for i8[src]

impl Truthy for i16[src]

impl Truthy for i32[src]

impl Truthy for i64[src]

impl Truthy for i128[src]

impl Truthy for isize[src]

impl Truthy for u8[src]

impl Truthy for u16[src]

impl Truthy for u32[src]

impl Truthy for u64[src]

impl Truthy for u128[src]

impl Truthy for usize[src]

impl<T1> Truthy for (T1,)[src]

impl<T1, T2> Truthy for (T1, T2)[src]

impl<T1, T2, T3> Truthy for (T1, T2, T3)[src]

impl<T1, T2, T3, T4> Truthy for (T1, T2, T3, T4)[src]

impl<T1, T2, T3, T4, T5> Truthy for (T1, T2, T3, T4, T5)[src]

impl<T1, T2, T3, T4, T5, T6> Truthy for (T1, T2, T3, T4, T5, T6)[src]

impl<T1, T2, T3, T4, T5, T6, T7> Truthy for (T1, T2, T3, T4, T5, T6, T7)[src]

impl<T1, T2, T3, T4, T5, T6, T7, T8> Truthy for (T1, T2, T3, T4, T5, T6, T7, T8)[src]

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9> Truthy for (T1, T2, T3, T4, T5, T6, T7, T8, T9)[src]

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Truthy for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)[src]

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Truthy for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)[src]

impl<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> Truthy for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)[src]

impl Truthy for bool[src]

impl Truthy for f32[src]

impl Truthy for f64[src]

impl Truthy for ()[src]

impl<'_> Truthy for &'_ str[src]

impl<T> Truthy for Option<T> where
    T: Truthy
[src]

impl<T, E> Truthy for Result<T, E> where
    T: Truthy
[src]

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

Loading content...

Implementors

Loading content...