Trait gluon_vm::thread::ThreadInternal
[−]
[src]
pub trait ThreadInternal { fn current_frame(&self) -> StackFrame; fn root<'vm, T: Userdata>(&'vm self, v: GcPtr<Box<Userdata>>) -> Option<Root<'vm, T>>; fn root_string<'vm>(&'vm self, ptr: GcPtr<Str>) -> RootStr<'vm>; fn root_value(&self, value: Value) -> RootedValue<RootedThread>; fn root_value_ref(&self, value: Value) -> RootedValue<&Thread>; fn alloc<D>(&self, stack: &Stack, def: D) -> GcPtr<D::Value> where D: DataDef + Traverseable, D::Value: Sized + Any; fn new_data(&self, tag: VMTag, fields: &[Value]) -> Value; fn add_bytecode(&self, name: &str, typ: TcType, args: VMIndex, instructions: Vec<Instruction>); fn call_module(&self, typ: &TcType, closure: GcPtr<ClosureData>) -> Result<Value>; fn call_function<'b>(&'b self, stack: StackFrame<'b>, args: VMIndex) -> Result<Option<StackFrame<'b>>>; fn resume(&self) -> Result<()>; fn global_env(&self) -> &Arc<GlobalVMState>; fn deep_clone(&self, value: Value) -> Result<Value>; }
Internal functions for interacting with threads. These functions should be considered both unsafe and unstable
Required Methods
fn current_frame(&self) -> StackFrame
Returns the current stackframe
fn root<'vm, T: Userdata>(&'vm self, v: GcPtr<Box<Userdata>>) -> Option<Root<'vm, T>>
Roots a userdata
fn root_string<'vm>(&'vm self, ptr: GcPtr<Str>) -> RootStr<'vm>
Roots a string
fn root_value(&self, value: Value) -> RootedValue<RootedThread>
Roots a value
fn root_value_ref(&self, value: Value) -> RootedValue<&Thread>
Roots a value
fn alloc<D>(&self, stack: &Stack, def: D) -> GcPtr<D::Value> where D: DataDef + Traverseable, D::Value: Sized + Any
Allocates a new value from a given DataDef
.
Takes the stack as it may collect if the collection limit has been reached.
fn new_data(&self, tag: VMTag, fields: &[Value]) -> Value
fn add_bytecode(&self, name: &str, typ: TcType, args: VMIndex, instructions: Vec<Instruction>)
fn call_module(&self, typ: &TcType, closure: GcPtr<ClosureData>) -> Result<Value>
Calls a module, allowed to to run IO expressions
fn call_function<'b>(&'b self, stack: StackFrame<'b>, args: VMIndex) -> Result<Option<StackFrame<'b>>>
Calls a function on the stack.
When this function is called it is expected that the function exists at
stack.len() - args - 1
and that the arguments are of the correct type
fn resume(&self) -> Result<()>
fn global_env(&self) -> &Arc<GlobalVMState>
fn deep_clone(&self, value: Value) -> Result<Value>
Implementors
impl ThreadInternal for Thread