[][src]Enum kb::Val

pub enum Val {
    Invalid,
    Nil,
    Bool(bool),
    Number(f64),
    String(RcStr),
    List(Rc<List>),
    Func(Func),
    GenObj(GenObjPtr),
}

Variants

Invalid

E.g. to check for usage before assignment

Nil
Bool(bool)
Number(f64)
String(RcStr)

Use of RcStr over Rc is by design -- this allows kb to interoperate with rest of mtots without copying the String all over the place

List(Rc<List>)
Func(Func)
GenObj(GenObjPtr)

Implementations

impl Val[src]

pub fn truthy(&self) -> bool[src]

pub fn number(&self) -> Option<f64>[src]

pub fn expect_number(&self) -> Result<f64, Val>[src]

pub fn list(&self) -> Option<&List>[src]

pub fn expect_list(&self) -> Result<&List, Val>[src]

pub fn func(&self) -> Option<&Rc<Code>>[src]

pub fn expect_func(&self) -> Result<&Rc<Code>, Val>[src]

pub fn genobj(&self) -> Option<&GenObjPtr>[src]

pub fn expect_genobj(&self) -> Result<&GenObjPtr, Val>[src]

pub fn lt(&self, other: &Self) -> Result<bool, Val>[src]

Trait Implementations

impl Clone for Val[src]

impl Debug for Val[src]

impl Display for Val[src]

impl<'_> From<&'_ RcStr> for Val[src]

impl<'_> From<&'_ str> for Val[src]

impl From<RcStr> for Val[src]

impl From<String> for Val[src]

impl From<Vec<Val>> for Val[src]

impl From<bool> for Val[src]

impl PartialEq<Val> for Val[src]

impl StructuralPartialEq for Val[src]

Auto Trait Implementations

impl !RefUnwindSafe for Val

impl !Send for Val

impl !Sync for Val

impl Unpin for Val

impl !UnwindSafe for Val

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.