pub struct VM<'a> { /* private fields */ }Expand description
Virtual machine state
Implementations§
Source§impl<'a> VM<'a>
impl<'a> VM<'a>
Sourcepub fn with_primitives(arena: &'a mut Arena) -> Self
pub fn with_primitives(arena: &'a mut Arena) -> Self
Create a VM with all primitives registered
Sourcepub fn register_primitives(&mut self)
pub fn register_primitives(&mut self)
Register all arena-based primitives in the global environment
Sourcepub fn define_global(&mut self, name: String, value_id: ValueId)
pub fn define_global(&mut self, name: String, value_id: ValueId)
Set a global variable
Sourcepub fn lookup_global(&self, name: &str) -> Option<ValueId>
pub fn lookup_global(&self, name: &str) -> Option<ValueId>
Look up a global variable
Sourcepub fn get_globals(&self) -> HashMap<String, ValueId>
pub fn get_globals(&self) -> HashMap<String, ValueId>
Get a clone of all global variables
Sourcepub fn set_globals(&mut self, globals: HashMap<String, ValueId>)
pub fn set_globals(&mut self, globals: HashMap<String, ValueId>)
Set all global variables (replaces existing globals)
Sourcepub fn extend_globals(&mut self, additional: HashMap<String, ValueId>)
pub fn extend_globals(&mut self, additional: HashMap<String, ValueId>)
Extend global variables with additional bindings (merges, doesn’t replace)
Sourcepub fn get_user_globals(&self) -> HashMap<String, ValueId>
pub fn get_user_globals(&self) -> HashMap<String, ValueId>
Get only user-defined global variables (excluding primitives)
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for VM<'a>
impl<'a> !Send for VM<'a>
impl<'a> !Sync for VM<'a>
impl<'a> !UnwindSafe for VM<'a>
impl<'a> Freeze for VM<'a>
impl<'a> Unpin for VM<'a>
impl<'a> UnsafeUnpin for VM<'a>
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