Extism.Plugin (extism v0.3.0)

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

Link to this section 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

Link to this section Functions

Link to this function

call(plugin, name, input)

Call a plugin's function by name

examples

Examples

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

parameters

Parameters

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

returns

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

update(plugin, manifest, wasi)

Updates the manifest of the given plugin

parameters

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)