[][src]Function wasmer_runtime::instantiate

pub fn instantiate(
    wasm: &[u8],
    import_object: &ImportObject
) -> Result<Instance>

Compile and instantiate WebAssembly code without creating a Module.

Params:

  • wasm: A &[u8] containing the binary code of the wasm module you want to compile.
  • import_object: An object containing the values to be imported into the newly-created Instance, such as functions or Memory objects. There must be one matching property for each declared import of the compiled module or else a LinkError is thrown.

Errors:

If the operation fails, the function returns a error::CompileError, error::LinkError, or error::RuntimeError (all combined into an error::Error), depending on the cause of the failure.