Struct wasmtime_runtime::InstanceHandle [−][src]
pub struct InstanceHandle { /* fields omitted */ }Expand description
A handle holding an Instance of a WebAssembly module.
Implementations
impl InstanceHandle[src]
impl InstanceHandle[src]pub unsafe fn from_vmctx(vmctx: *mut VMContext) -> Self[src]
pub unsafe fn from_vmctx(vmctx: *mut VMContext) -> Self[src]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.
pub fn vmctx_ptr(&self) -> *mut VMContext[src]
pub fn vmctx_ptr(&self) -> *mut VMContext[src]Return a raw pointer to the vmctx used by compiled wasm code.
pub fn lookup_by_declaration(&self, export: &EntityIndex) -> Export[src]
pub fn lookup_by_declaration(&self, export: &EntityIndex) -> Export[src]Lookup an export with the given export declaration.
pub fn exports(&self) -> Iter<'_, String, EntityIndex>[src]
pub fn exports(&self) -> Iter<'_, String, EntityIndex>[src]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.
pub fn host_state(&self) -> &dyn Any[src]
pub fn host_state(&self) -> &dyn Any[src]Return a reference to the custom state attached to this instance.
pub fn memory_index(&self, memory: &VMMemoryDefinition) -> DefinedMemoryIndex[src]
pub fn memory_index(&self, memory: &VMMemoryDefinition) -> DefinedMemoryIndex[src]Return the memory index for the given VMMemoryDefinition in this instance.
pub fn memory_grow(
&self,
memory_index: DefinedMemoryIndex,
delta: u32
) -> Option<u32>[src]
pub fn memory_grow(
&self,
memory_index: DefinedMemoryIndex,
delta: u32
) -> Option<u32>[src]Grow memory in this instance by the specified amount of pages.
Returns None if memory can’t be grown by the specified amount
of pages.
pub fn table_index(&self, table: &VMTableDefinition) -> DefinedTableIndex[src]
pub fn table_index(&self, table: &VMTableDefinition) -> DefinedTableIndex[src]Return the table index for the given VMTableDefinition in this instance.
pub fn table_grow(
&self,
table_index: TableIndex,
delta: u32,
init_value: TableElement
) -> Option<u32>[src]
pub fn table_grow(
&self,
table_index: TableIndex,
delta: u32,
init_value: TableElement
) -> Option<u32>[src]Grow table in this instance by the specified amount of elements.
When the table is successfully grown, returns the original size of the table.
Returns None if memory can’t be grown by the specified amount of pages
or if the init_value is the incorrect table element type.
pub fn defined_table_grow(
&self,
table_index: DefinedTableIndex,
delta: u32,
init_value: TableElement
) -> Option<u32>[src]
pub fn defined_table_grow(
&self,
table_index: DefinedTableIndex,
delta: u32,
init_value: TableElement
) -> Option<u32>[src]Grow table in this instance by the specified amount of elements.
When the table is successfully grown, returns the original size of the table.
Returns None if memory can’t be grown by the specified amount of pages
or if the init_value is the incorrect table element type.
pub fn table_get(
&self,
table_index: DefinedTableIndex,
index: u32
) -> Option<TableElement>[src]
pub fn table_get(
&self,
table_index: DefinedTableIndex,
index: u32
) -> Option<TableElement>[src]Get table element reference.
Returns None if index is out of bounds.
pub fn table_set(
&self,
table_index: DefinedTableIndex,
index: u32,
val: TableElement
) -> Result<(), ()>[src]
pub fn table_set(
&self,
table_index: DefinedTableIndex,
index: u32,
val: TableElement
) -> Result<(), ()>[src]Set table element reference.
Returns an error if the index is out of bounds
pub fn defined_table_fill(
&self,
table_index: DefinedTableIndex,
dst: u32,
val: TableElement,
len: u32
) -> Result<(), Trap>[src]
pub fn defined_table_fill(
&self,
table_index: DefinedTableIndex,
dst: u32,
val: TableElement,
len: u32
) -> Result<(), Trap>[src]Fill a region of the table.
Returns an error if the region is out of bounds or val is not of the correct type.
pub fn get_defined_table(&self, index: DefinedTableIndex) -> &Table[src]
pub fn get_defined_table(&self, index: DefinedTableIndex) -> &Table[src]Get a table defined locally within this module.
pub unsafe fn clone(&self) -> InstanceHandle[src]
pub unsafe fn clone(&self) -> InstanceHandle[src]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
impl Hash for InstanceHandle[src]
impl Hash for InstanceHandle[src]impl PartialEq<InstanceHandle> for InstanceHandle[src]
impl PartialEq<InstanceHandle> for InstanceHandle[src]fn eq(&self, other: &InstanceHandle) -> bool[src]
fn eq(&self, other: &InstanceHandle) -> bool[src]This method tests for self and other values to be equal, and is used
by ==. Read more
fn ne(&self, other: &InstanceHandle) -> bool[src]
fn ne(&self, other: &InstanceHandle) -> bool[src]This method tests for !=.
impl Eq for InstanceHandle[src]
impl StructuralEq for InstanceHandle[src]
impl StructuralPartialEq for InstanceHandle[src]
Auto Trait Implementations
impl !RefUnwindSafe for InstanceHandle
impl !Send for InstanceHandle
impl !Sync for InstanceHandle
impl Unpin for InstanceHandle
impl !UnwindSafe for InstanceHandle
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized, [src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized, [src]pub fn equivalent(&self, key: &K) -> bool[src]
pub fn equivalent(&self, key: &K) -> bool[src]Compare self to key and return true if they are equal.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,