Wasmer::ImportObject
Inherits Reference / Object
ImportObject contains all of the import data used when instantiating a WebAssembly module.
Constructors
new
SourceInstance methods
contains_namespace?(name : String) : Bool
Returns true if the ImportObject contains the given namespace (or module name)
imports = ImportObject.new
imports.contains_namespace?("env")
externs
Sourceregister(ns_name : String, ns : Hash(String, WithExtern)) : Nil
Registers a namespace (or module name) in the ImportObject.
It takes two arguments: the namespace name and a hash with imports names as key and externs as value
Note: An extern is anything implementing WithExtern : Function, Global, Memory, Table
imports = ImportObject.new
imports.register("env", {"host_function" => host_function, "host_global" => host_global})
Note: The namespace (or module name) may be empty:
imports = ImportObject.new
imports.register("", {"host_function" => host_function, "host_global" => host_global})