Wasmex.Components.Instance (wasmex v0.15.0)

Copy Markdown

The component model equivalent to Wasmex.Instance.

Most applications should use Wasmex.Components or Wasmex.Components.ComponentServer instead.

Summary

Types

t()

@type t() :: %Wasmex.Components.Instance{
  instance_resource: binary(),
  reference: reference(),
  store_resource: binary()
}

Functions

call_function(instance, function_or_path, args, from, timeout \\ nil)

@spec call_function(
  t(),
  Wasmex.Components.function_name_or_path(),
  list(),
  GenServer.from(),
  non_neg_integer() | nil
) :: :ok

Schedules a call to an exported component function.

The from argument must be the caller tuple passed to GenServer.handle_call/3. The result is sent to that caller after execution. If timeout expires first, the component call continues to completion because Wasmtime cannot cancel it without invalidating the instance; the late result is discarded.

new(store_or_caller, component, imports)