[−][src]Enum xmachine::Value
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]
Auto Trait Implementations
Blanket Implementations
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,