Extism.Plugin (extism v0.5.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

Updates the manifest of the given 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, context \\ nil)

Creates a new plugin

Link to this function

update(plugin, manifest, wasi)

Updates the manifest of the given plugin

Parameters

  • ctx: The Context to manage this plugin
  • manifest: The String or Map of the WASM module or manifest
  • wasi: A bool you set to true if you want WASI support
Link to this function

wrap_resource(ctx, plugin_id)