[][src]Struct dyon::runtime::Runtime

pub struct Runtime {
    pub stack: Vec<Variable>,
    pub call_stack: Vec<Call>,
    pub local_stack: Vec<(Arc<String>, usize)>,
    pub current_stack: Vec<(Arc<String>, usize)>,
    // some fields omitted
}

Stores data needed for running a Dyon program.

Fields

stack: Vec<Variable>

Stores variables on the stack.

call_stack: Vec<Call>

name, file, stack_len, local_len.

local_stack: Vec<(Arc<String>, usize)>

Stores stack of locals.

current_stack: Vec<(Arc<String>, usize)>

Stores stack of current objects.

When a current object is used, the runtime searches backwards until it finds the last current variable with the name.

Methods

impl Runtime[src]

pub fn new() -> Runtime[src]

Creates a new Runtime.

pub fn pop<T: PopVariable>(&mut self) -> Result<T, String>[src]

Pops variable from stack.

pub fn pop_vec4<T: ConvertVec4>(&mut self) -> Result<T, String>[src]

Pops 4D vector from stack.

pub fn pop_mat4<T: ConvertMat4>(&mut self) -> Result<T, String>[src]

Pops 4D matrix from stack.

pub fn var<T: PopVariable>(&self, var: &Variable) -> Result<T, String>[src]

Gets variable.

pub fn var_vec4<T: ConvertVec4>(&self, var: &Variable) -> Result<T, String>[src]

Gets 4D vector.

pub fn var_mat4<T: ConvertMat4>(&self, var: &Variable) -> Result<T, String>[src]

Gets 4D matrix.

pub fn push<T: PushVariable>(&mut self, val: T)[src]

Push value to stack.

pub fn push_vec4<T: ConvertVec4>(&mut self, val: T)[src]

Push Vec4 to stack.

pub fn push_mat4<T: ConvertMat4>(&mut self, val: T)[src]

Push Mat4 to stack.

pub fn push_rust<T: 'static>(&mut self, val: T)[src]

Pushes Rust object to stack.

pub fn expected(&self, var: &Variable, ty: &str) -> String[src]

Generates error message that a certain type was expected.

pub fn resolve<'a>(&'a self, var: &'a Variable) -> &'a Variable[src]

Resolves a variable reference if any, getting a pointer to the variable on the stack.

pub fn run(&mut self, module: &Arc<Module>) -> Result<(), String>[src]

Run main function in a module.

pub fn go(
    &mut self,
    go: &Go,
    module: &Arc<Module>
) -> Result<(Option<Variable>, Flow), String>
[src]

Start a new thread and return the handle.

pub fn call_closure(
    &mut self,
    call: &CallClosure,
    module: &Arc<Module>
) -> Result<(Option<Variable>, Flow), String>
[src]

Call closure.

pub fn call(
    &mut self,
    call: &Call,
    module: &Arc<Module>
) -> Result<(Option<Variable>, Flow), String>
[src]

Called from the outside, e.g. a loader script by call or call_ret intrinsic.

pub fn call_str(
    &mut self,
    function: &str,
    args: &[Variable],
    module: &Arc<Module>
) -> Result<(), String>
[src]

Calls function by name.

pub fn call_str_ret(
    &mut self,
    function: &str,
    args: &[Variable],
    module: &Arc<Module>
) -> Result<Variable, String>
[src]

Call function by name, returning a value.

Trait Implementations

impl Default for Runtime[src]

Auto Trait Implementations

impl Send for Runtime

impl !Sync for Runtime

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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

impl<T, U> TryInto 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> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.