Struct wasmer_runtime_core_near::Instance
source · [−]Expand description
An instantiated WebAssembly module.
An Instance
represents a WebAssembly module that
has been instantiated with an ImportObject
and is
ready to be called.
Fields
module: Arc<ModuleInner>
Reference to the module used to instantiate this instance.
exports: Exports
The exports of this instance.
Implementations
Load an Instance
using the given loader.
pub fn func<Args, Rets>(
&self,
name: &str
) -> ResolveResult<Func<'_, Args, Rets, Wasm>> where
Args: WasmTypeList,
Rets: WasmTypeList,
👎 Deprecated since 0.17.0: Please use instance.exports.get(name)
instead
pub fn func<Args, Rets>(
&self,
name: &str
) -> ResolveResult<Func<'_, Args, Rets, Wasm>> where
Args: WasmTypeList,
Rets: WasmTypeList,
Please use instance.exports.get(name)
instead
Resolve a function by name.
👎 Deprecated since 0.17.0: Please use instance.exports.get(name)
instead
Please use instance.exports.get(name)
instead
This returns the representation of a function that can be called safely.
Usage:
instance
.dyn_func("foo")?
.call(&[])?;
Call an exported WebAssembly function given the export name.
Pass arguments by wrapping each one in the Value
enum.
The returned values are also each wrapped in a Value
.
Note:
This returns CallResult<Vec<Value>>
in order to support
the future multi-value returns WebAssembly feature.
Consider using the more explicit Exports::get
with [
DynFunc::call`]
instead. For example:
// ...
let foo: DynFunc = instance.exports.get("foo")?;
let results = foo.call(&[Value::I32(42)])?;
// ...
Usage:
// ...
let results = instance.call("foo", &[Value::I32(42)])?;
// ...
Returns a mutable reference to the
Ctx
used by this Instance.
pub fn exports(&self) -> ExportIter<'_>ⓘNotable traits for ExportIter<'a>impl<'a> Iterator for ExportIter<'a> type Item = (String, Export);
pub fn exports(&self) -> ExportIter<'_>ⓘNotable traits for ExportIter<'a>impl<'a> Iterator for ExportIter<'a> type Item = (String, Export);
impl<'a> Iterator for ExportIter<'a> type Item = (String, Export);
Returns an iterator over all of the items exported from this instance.
Get the value of an internal field
Set the value of an internal field.
Trait Implementations
Gets an export by name.
Gets all exports in the namespace.