Skip to main content

Truthy

Trait Truthy 

Source
pub trait Truthy {
    // Required method
    fn truthy(&self) -> bool;
}
Expand description

Truthiness for GENERATED code — ONE definition shared with the interpreter’s RuntimeValue::is_truthy and the VM’s Value::is_truthy. Falsy: false, numeric zero (-0.0 is zero; NaN is nonzero and truthy), nothing (None), and empty Text/Seq/Map/Set. Everything else is truthy.

Required Methods§

Source

fn truthy(&self) -> bool

Implementations on Foreign Types§

Source§

impl Truthy for &str

Source§

fn truthy(&self) -> bool

Source§

impl Truthy for bool

Source§

fn truthy(&self) -> bool

Source§

impl Truthy for char

Source§

fn truthy(&self) -> bool

Source§

impl Truthy for f64

Source§

fn truthy(&self) -> bool

Source§

impl Truthy for i64

Source§

fn truthy(&self) -> bool

Source§

impl Truthy for String

Source§

fn truthy(&self) -> bool

Source§

impl<T: Truthy> Truthy for Option<T>

nothing is falsy; a present value keeps its own truthiness (the interpreter never sees the Some wrapper — Some(0) at runtime IS 0).

Source§

fn truthy(&self) -> bool

Implementors§