Extism.Plugin (extism v1.0.0)

A Plugin represents an instance of your WASM program from the given manifest.

Summary

Functions

Call a plugin's function by name

Frees the plugin

Returns true if the given plugin responds to the given function name

Creates a new plugin

Functions

Link to this function

call(plugin, name, input)

Call a plugin's function by name

Examples

iex> {:ok, plugin} = Extism.Plugin.new(manifest, false)
iex> {:ok, output} = Extism.Plugin.call(plugin, "count_vowels", "this is a test")
   # {:ok, "{"count": 4}"}

Parameters

  • plugin: The plugin
  • name: The name of the function as a string
  • input: The input data as a string

Returns

A string representation of the functions output

Frees the plugin

Link to this function

has_function(plugin, function_name)

Returns true if the given plugin responds to the given function name

Link to this function

new(manifest, wasi \\ false)

Creates a new plugin

Parameters

Returns

A result tuple with the plugin or an error

Link to this function

wrap_resource(plugin)