pub trait InstanceGlobals {
type Global: Clone;
// Required methods
fn get_global(&mut self, export_name: &str) -> Self::Global;
fn get_global_value(&mut self, global: &Self::Global) -> Value;
fn set_global_value(&mut self, global: &Self::Global, value: Value);
}
Expand description
An adapter for a wasm module instance that is focused on getting and setting globals.
Required Associated Types§
Required Methods§
sourcefn get_global(&mut self, export_name: &str) -> Self::Global
fn get_global(&mut self, export_name: &str) -> Self::Global
Get a handle to a global by it’s export name.
The requested export is must exist in the exported list, and it should be a mutable global.
sourcefn get_global_value(&mut self, global: &Self::Global) -> Value
fn get_global_value(&mut self, global: &Self::Global) -> Value
Get the current value of the global.
sourcefn set_global_value(&mut self, global: &Self::Global, value: Value)
fn set_global_value(&mut self, global: &Self::Global, value: Value)
Update the current value of the global.
The global behind the handle is guaranteed to be mutable and the value to be the same type as the global.