[][src]Enum xmachine::Value

pub enum Value {
    String(String),
    Number(f64),
    List(Vec<Ref<Self>>),
    Tree(BTreeMap<String, Ref<Self>>),
    Function(Function<Machine, (), Machine>),
    Error(String),
    None,
}

Variants

String(String)Number(f64)List(Vec<Ref<Self>>)Tree(BTreeMap<String, Ref<Self>>)Function(Function<Machine, (), Machine>)Error(String)None

Methods

impl Value[src]

pub fn number<N: Into<f64>>(n: N) -> Ref<Self>[src]

Creates a new reference to a Number

pub fn string<S: ToString>(s: S) -> Ref<Self>[src]

Creates a new reference to a String

pub fn list() -> Ref<Self>[src]

Creates a new reference to an empty List

pub fn tree() -> Ref<Self>[src]

Creates a new reference to an empty Tree

pub fn function(f: fn(_: &mut Machine), context: &Machine) -> Ref<Self>[src]

Creates a reference to a Function with a captured context, basically a Closure

pub fn error<S: ToString>(s: S) -> Ref<Self>[src]

Creates a reference to an Error value

pub fn none() -> Ref<Self>[src]

Creates a reference to an None value

pub fn copy(&self) -> Ref<Self>[src]

Copies the contents of this value

pub fn call(&self, machine: &mut Machine)[src]

Call this function in the context of the Machine captured when this instance of the function was created

pub fn call_global(&self, machine: &mut Machine)[src]

Call this function in the context of the current machine, meaning, execute the instructions of this function as if they were not in a function.

pub fn index<S: ToString>(&mut self, s: S) -> Ref<Self>[src]

Return a reference to a value contained within a collection

Trait Implementations

impl Display for Value[src]

How to display value

impl Debug for Value[src]

This implementation is a hack for implementing Display for Value

impl PartialEq<Value> for Value[src]

impl From<Value> for bool[src]

############################################################ The following traits are for implementing foreign functions! ############################################################ Convert Value into a bool

impl From<Value> for String[src]

Get a function from the value

impl From<Value> for Vec<Ref<Value>>[src]

Convert Value to unwrapped List

impl From<Value> for BTreeMap<String, Ref<Value>>[src]

Convert Value to unwrapped Tree

impl From<Value> for f64[src]

Convert to floating point value

impl From<Value> for i32[src]

Convert to integer value

impl From<String> for Value[src]

Make Value from String

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

Make Value from &str

impl From<f64> for Value[src]

Make Value from Number

impl From<i32> for Value[src]

Make Value from Number

impl From<Vec<Rc<Value>>> for Value[src]

Make Value from List

impl From<BTreeMap<String, Rc<Value>>> for Value[src]

Make Value from Tree

impl Clone for Value[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Unpin for Value

impl !Send for Value

impl !Sync for Value

Blanket Implementations

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> Into<U> for T where
    U: From<T>, 
[src]

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

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.

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[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]