pub struct Context { /* private fields */ }
Expand description
The state of the virtual machine
This contains all necessary runtime data and gets shared with objects that
implement CallProtocol
as well as interrupts.
Implementations§
Source§impl Context
impl Context
pub fn new() -> Self
Sourcepub fn lookup_code_object(&self, name: &Variable) -> Lovm2Result<CallableRef>
pub fn lookup_code_object(&self, name: &Variable) -> Lovm2Result<CallableRef>
Try to resolve the given name to a callable
Sourcepub fn stack_mut(&mut self) -> &mut Vec<Value>
pub fn stack_mut(&mut self) -> &mut Vec<Value>
Get a mutable reference to the value stack itself
Sourcepub fn lstack_mut(&mut self) -> &mut Vec<Frame>
pub fn lstack_mut(&mut self) -> &mut Vec<Frame>
Get a mutable reference to the value lstack itself
Sourcepub fn frame_mut(&mut self) -> Lovm2Result<&mut Frame>
pub fn frame_mut(&mut self) -> Lovm2Result<&mut Frame>
Get a mutable reference to the last stack frame
Sourcepub fn set_global<T>(&mut self, var: T, val: Value)
pub fn set_global<T>(&mut self, var: T, val: Value)
Set value of a global variable
Sourcepub fn push_frame(&mut self, argn: u8)
pub fn push_frame(&mut self, argn: u8)
Create a frame on the callstack
Sourcepub fn push_value(&mut self, value: Value)
pub fn push_value(&mut self, value: Value)
Put a new value on the stack
Sourcepub fn pop_value(&mut self) -> Lovm2Result<Value>
pub fn pop_value(&mut self) -> Lovm2Result<Value>
Remove the last value on stack
Sourcepub fn last_value_mut(&mut self) -> Lovm2Result<&mut Value>
pub fn last_value_mut(&mut self) -> Lovm2Result<&mut Value>
Get a mutable reference to the last value on stack
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more