[−][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: impl 'static + Fn(&mut Machine),
context: &Machine
) -> Ref<Self>
[src]
f: impl 'static + Fn(&mut Machine),
context: &Machine
) -> Ref<Self>
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 is_err(&self) -> bool
[src]
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 Debug for Value
[src]
This implementation is a hack for implementing Display for Value
impl Display for Value
[src]
How to display value
impl Rem<Value> for Value
[src]
Remainder of two values
type Output = Value
The resulting type after applying the %
operator.
fn rem(self, rhs: Self) -> Self::Output
[src]
impl Sub<Value> for Value
[src]
Subtract two values
type Output = Value
The resulting type after applying the -
operator.
fn sub(self, rhs: Self) -> Self::Output
[src]
impl PartialEq<Value> for Value
[src]
impl PartialOrd<Value> for Value
[src]
fn partial_cmp(&self, other: &Value) -> Option<Ordering>
[src]
fn lt(&self, other: &Value) -> bool
[src]
fn le(&self, other: &Value) -> bool
[src]
fn gt(&self, other: &Value) -> bool
[src]
fn ge(&self, other: &Value) -> bool
[src]
impl Add<Value> for Value
[src]
############################################################## The following traits are for implementing operators and logic! ############################################################## Add two values
type Output = Value
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self::Output
[src]
impl Mul<Value> for Value
[src]
Multiply two values
type Output = Value
The resulting type after applying the *
operator.
fn mul(self, rhs: Self) -> Self::Output
[src]
impl Div<Value> for Value
[src]
Divide two values
type Output = Value
The resulting type after applying the /
operator.
fn div(self, rhs: Self) -> Self::Output
[src]
impl Not for Value
[src]
Negate value
type Output = Value
The resulting type after applying the !
operator.
fn not(self) -> Self::Output
[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<bool> for Value
[src]
Make Value from bool
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(&self) -> Value
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[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,