Struct wasmtime_runtime::InstanceHandle
source · pub struct InstanceHandle { /* private fields */ }
Expand description
A handle holding an Instance
of a WebAssembly module.
Implementations§
source§impl InstanceHandle
impl InstanceHandle
sourcepub unsafe fn from_vmctx(vmctx: *mut VMContext) -> Self
pub unsafe fn from_vmctx(vmctx: *mut VMContext) -> Self
Create a new InstanceHandle
pointing at the instance
pointed to by the given VMContext
pointer.
Safety
This is unsafe because it doesn’t work on just any VMContext
, it must
be a VMContext
allocated as part of an Instance
.
sourcepub fn vmctx_ptr(&self) -> *mut VMContext
pub fn vmctx_ptr(&self) -> *mut VMContext
Return a raw pointer to the vmctx used by compiled wasm code.
sourcepub fn get_exported_func(&mut self, export: FuncIndex) -> ExportFunction
pub fn get_exported_func(&mut self, export: FuncIndex) -> ExportFunction
Lookup a function by index.
sourcepub fn get_exported_global(&mut self, export: GlobalIndex) -> ExportGlobal
pub fn get_exported_global(&mut self, export: GlobalIndex) -> ExportGlobal
Lookup a global by index.
sourcepub fn get_exported_memory(&mut self, export: MemoryIndex) -> ExportMemory
pub fn get_exported_memory(&mut self, export: MemoryIndex) -> ExportMemory
Lookup a memory by index.
sourcepub fn get_exported_table(&mut self, export: TableIndex) -> ExportTable
pub fn get_exported_table(&mut self, export: TableIndex) -> ExportTable
Lookup a table by index.
sourcepub fn get_export_by_index(&mut self, export: EntityIndex) -> Export
pub fn get_export_by_index(&mut self, export: EntityIndex) -> Export
Lookup an item with the given index.
sourcepub fn exports(&self) -> Iter<'_, String, EntityIndex>
pub fn exports(&self) -> Iter<'_, String, EntityIndex>
Return an iterator over the exports of this instance.
Specifically, it provides access to the key-value pairs, where the keys
are export names, and the values are export declarations which can be
resolved lookup_by_declaration
.
sourcepub fn host_state(&self) -> &dyn Any
pub fn host_state(&self) -> &dyn Any
Return a reference to the custom state attached to this instance.
sourcepub fn get_defined_memory(&mut self, index: DefinedMemoryIndex) -> *mut Memory
pub fn get_defined_memory(&mut self, index: DefinedMemoryIndex) -> *mut Memory
Get a memory defined locally within this module.
sourcepub unsafe fn table_index(&self, table: &VMTableDefinition) -> DefinedTableIndex
pub unsafe fn table_index(&self, table: &VMTableDefinition) -> DefinedTableIndex
Return the table index for the given VMTableDefinition
in this instance.
sourcepub fn get_defined_table(&mut self, index: DefinedTableIndex) -> *mut Table
pub fn get_defined_table(&mut self, index: DefinedTableIndex) -> *mut Table
Get a table defined locally within this module.
sourcepub fn get_defined_table_with_lazy_init(
&mut self,
index: DefinedTableIndex,
range: impl Iterator<Item = u32>
) -> *mut Table
pub fn get_defined_table_with_lazy_init( &mut self, index: DefinedTableIndex, range: impl Iterator<Item = u32> ) -> *mut Table
Get a table defined locally within this module, lazily initializing the given range first.
sourcepub unsafe fn set_store(&mut self, store: *mut dyn Store)
pub unsafe fn set_store(&mut self, store: *mut dyn Store)
Configure the *mut dyn Store
internal pointer after-the-fact.
This is provided for the original Store
itself to configure the first
self-pointer after the original Box
has been initialized.
sourcepub unsafe fn clone(&self) -> InstanceHandle
pub unsafe fn clone(&self) -> InstanceHandle
Returns a clone of this instance.
This is unsafe because the returned handle here is just a cheap clone of the internals, there’s no lifetime tracking around its validity. You’ll need to ensure that the returned handles all go out of scope at the same time.
Trait Implementations§
source§impl Hash for InstanceHandle
impl Hash for InstanceHandle
source§impl PartialEq<InstanceHandle> for InstanceHandle
impl PartialEq<InstanceHandle> for InstanceHandle
source§fn eq(&self, other: &InstanceHandle) -> bool
fn eq(&self, other: &InstanceHandle) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for InstanceHandle
impl Send for InstanceHandle
impl StructuralEq for InstanceHandle
impl StructuralPartialEq for InstanceHandle
impl Sync for InstanceHandle
Auto Trait Implementations§
impl !RefUnwindSafe for InstanceHandle
impl Unpin for InstanceHandle
impl !UnwindSafe for InstanceHandle
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.