Skip to main content

VM

Struct VM 

Source
pub struct VM { /* private fields */ }

Implementations§

Source§

impl VM

Source

pub fn set_gas_budget(&mut self, limit: u64)

Source

pub fn clear_gas_budget(&mut self)

Source

pub fn reset_gas_counter(&mut self)

Source

pub fn gas_used(&self) -> u64

Source

pub fn gas_remaining(&self) -> Option<u64>

Source

pub fn set_memory_budget_bytes(&mut self, limit_bytes: usize)

Source

pub fn set_memory_budget_kb(&mut self, limit_kb: u64)

Source

pub fn clear_memory_budget(&mut self)

Source

pub fn reset_memory_counter(&mut self)

Source

pub fn memory_used_bytes(&self) -> usize

Source

pub fn memory_remaining_bytes(&self) -> Option<usize>

Source§

impl VM

Source

pub fn new() -> Self

Source

pub fn with_config(config: &LustConfig) -> Self

Source

pub fn with_current<F, R>(f: F) -> CoreResult<R, String>
where F: FnOnce(&mut VM) -> CoreResult<R, String>,

Source

pub fn load_functions(&mut self, functions: Vec<Function>)

Source

pub fn register_structs(&mut self, defs: &HashMap<String, StructDef>)

Source

pub fn instantiate_struct( &self, struct_name: &str, fields: Vec<(Rc<String>, Value)>, ) -> Result<Value>

Source

pub fn register_trait_impl(&mut self, type_name: String, trait_name: String)

Source

pub fn register_native(&mut self, name: impl Into<String>, value: Value)

Source

pub fn export_prefix(&self) -> Option<String>

Source

pub fn record_exported_native(&mut self, export: NativeExport)

Source

pub fn register_exported_native<F>(&mut self, export: NativeExport, func: F)
where F: Fn(&[Value]) -> CoreResult<NativeCallResult, String> + 'static,

Source

pub fn register_type_stubs(&mut self, stubs: Vec<ModuleStub>)

Source

pub fn exported_type_stubs(&self) -> &[ModuleStub]

Source

pub fn take_type_stubs(&mut self) -> Vec<ModuleStub>

Source

pub fn exported_natives(&self) -> &[NativeExport]

Source

pub fn take_exported_natives(&mut self) -> Vec<NativeExport>

Source

pub fn clear_native_functions(&mut self)

Source

pub fn dump_externs_to_dir( &self, output_root: impl AsRef<Path>, ) -> Result<Vec<PathBuf>>

Source

pub fn dump_externs_to_dir_with_options( &self, output_root: impl AsRef<Path>, options: &DumpExternsOptions, ) -> Result<Vec<PathBuf>>

Source

pub fn get_global(&self, name: &str) -> Option<Value>

Source

pub fn global_names(&self) -> Vec<String>

Source

pub fn globals_snapshot(&self) -> Vec<(String, Value)>

Source

pub fn set_global(&mut self, name: impl Into<String>, value: Value)

Source

pub fn call(&mut self, function_name: &str, args: Vec<Value>) -> Result<Value>

Source

pub fn function_value(&self, function_name: &str) -> Option<Value>

Source

pub fn function_name(&self, index: usize) -> Option<&str>

Source

pub fn fail_task_handle( &mut self, handle: TaskHandle, error: LustError, ) -> Result<()>

Source§

impl VM

Source

pub fn value_to_string_for_concat( &mut self, value: &Value, ) -> Result<Rc<String>>

Source

pub fn call_value(&mut self, func: &Value, args: Vec<Value>) -> Result<Value>

Source§

impl VM

Source

pub fn spawn_task_value( &mut self, func: Value, args: Vec<Value>, ) -> Result<TaskHandle>

Source

pub fn spawn_tick_task(&mut self, function_name: &str) -> Result<TaskHandle>

Source

pub fn tick_task( &mut self, handle: TaskHandle, resume_value: Value, ) -> Result<Value>

Source

pub fn resume_task_handle( &mut self, handle: TaskHandle, resume_value: Option<Value>, ) -> Result<()>

Source

pub fn get_task_instance(&self, handle: TaskHandle) -> Result<&TaskInstance>

Source

pub fn current_task_handle(&self) -> Option<TaskHandle>

Source

pub fn create_native_future_task(&mut self) -> TaskHandle

Source

pub fn complete_native_future_task( &mut self, handle: TaskHandle, outcome: Result<Value, String>, ) -> Result<()>

Trait Implementations§

Source§

impl Default for VM

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V