pub struct VM { /* private fields */ }Implementations§
Source§impl VM
impl VM
pub fn set_gas_budget(&mut self, limit: u64)
pub fn clear_gas_budget(&mut self)
pub fn reset_gas_counter(&mut self)
pub fn gas_used(&self) -> u64
pub fn gas_remaining(&self) -> Option<u64>
pub fn set_memory_budget_bytes(&mut self, limit_bytes: usize)
pub fn set_memory_budget_kb(&mut self, limit_kb: u64)
pub fn clear_memory_budget(&mut self)
pub fn reset_memory_counter(&mut self)
pub fn memory_used_bytes(&self) -> usize
pub fn memory_remaining_bytes(&self) -> Option<usize>
Source§impl VM
impl VM
pub fn new() -> Self
pub fn with_config(config: &LustConfig) -> Self
pub fn with_current<F, R>(f: F) -> CoreResult<R, String>
pub fn load_functions(&mut self, functions: Vec<Function>)
pub fn register_structs(&mut self, defs: &HashMap<String, StructDef>)
pub fn instantiate_struct( &self, struct_name: &str, fields: Vec<(Rc<String>, Value)>, ) -> Result<Value>
pub fn register_trait_impl(&mut self, type_name: String, trait_name: String)
pub fn register_native(&mut self, name: impl Into<String>, value: Value)
pub fn export_prefix(&self) -> Option<String>
pub fn record_exported_native(&mut self, export: NativeExport)
pub fn register_exported_native<F>(&mut self, export: NativeExport, func: F)
pub fn register_type_stubs(&mut self, stubs: Vec<ModuleStub>)
pub fn exported_type_stubs(&self) -> &[ModuleStub]
pub fn take_type_stubs(&mut self) -> Vec<ModuleStub>
pub fn exported_natives(&self) -> &[NativeExport]
pub fn take_exported_natives(&mut self) -> Vec<NativeExport>
pub fn clear_native_functions(&mut self)
pub fn dump_externs_to_dir( &self, output_root: impl AsRef<Path>, ) -> Result<Vec<PathBuf>>
pub fn dump_externs_to_dir_with_options( &self, output_root: impl AsRef<Path>, options: &DumpExternsOptions, ) -> Result<Vec<PathBuf>>
pub fn get_global(&self, name: &str) -> Option<Value>
pub fn global_names(&self) -> Vec<String>
pub fn globals_snapshot(&self) -> Vec<(String, Value)>
pub fn set_global(&mut self, name: impl Into<String>, value: Value)
pub fn call(&mut self, function_name: &str, args: Vec<Value>) -> Result<Value>
pub fn function_value(&self, function_name: &str) -> Option<Value>
pub fn function_name(&self, index: usize) -> Option<&str>
pub fn fail_task_handle( &mut self, handle: TaskHandle, error: LustError, ) -> Result<()>
Source§impl VM
impl VM
pub fn spawn_task_value( &mut self, func: Value, args: Vec<Value>, ) -> Result<TaskHandle>
pub fn spawn_tick_task(&mut self, function_name: &str) -> Result<TaskHandle>
pub fn tick_task( &mut self, handle: TaskHandle, resume_value: Value, ) -> Result<Value>
pub fn resume_task_handle( &mut self, handle: TaskHandle, resume_value: Option<Value>, ) -> Result<()>
pub fn get_task_instance(&self, handle: TaskHandle) -> Result<&TaskInstance>
pub fn current_task_handle(&self) -> Option<TaskHandle>
pub fn create_native_future_task(&mut self) -> TaskHandle
pub fn complete_native_future_task( &mut self, handle: TaskHandle, outcome: Result<Value, String>, ) -> Result<()>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VM
impl !RefUnwindSafe for VM
impl !Send for VM
impl !Sync for VM
impl Unpin for VM
impl UnsafeUnpin for VM
impl !UnwindSafe for VM
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