package extism

  1. Overview
  2. Docs

Plugins contain functions that can be called

type t
val create : ?config:Manifest.config -> ?wasi:bool -> ?functions:Function.t list -> string -> (t, Error.t) Stdlib.result

Make a new plugin from raw WebAssembly or JSON encoded manifest

val create_exn : ?config:Manifest.config -> ?wasi:bool -> ?functions:Function.t list -> string -> t

Make a new plugin from raw WebAssembly or JSON encoded manifest

val of_manifest : ?wasi:bool -> ?functions:Function.t list -> Manifest.t -> (t, Error.t) Stdlib.result

Make a new plugin from a Manifest

val of_manifest_exn : ?wasi:bool -> ?functions:Function.t list -> Manifest.t -> t

Make a new plugin from a Manifest

val call_bigstring : t -> name:string -> Bigstringaf.t -> (Bigstringaf.t, Error.t) Stdlib.result

Call a function, uses Bigstringaf.t for input/output

val call_bigstring_exn : t -> name:string -> Bigstringaf.t -> Bigstringaf.t

Similar to call_bigstring but raises an exception using Error.unwrap

val call_string : t -> name:string -> string -> (string, Error.t) Stdlib.result

Call a function, uses string for input/output

val call_string_exn : t -> name:string -> string -> string

Similar to call_string but raises an exception using Error.unwrap

val call : (module Type.S with type t = 'a) -> (module Type.S with type t = 'b) -> t -> name:string -> 'a -> ('b, Error.t) Stdlib.result

call input_type output_type t ~name input executes a function with input and output types defined in Type

val call_exn : (module Type.S with type t = 'a) -> (module Type.S with type t = 'b) -> t -> name:string -> 'a -> 'b

Similar to call but raises an exception using Error.unwrap

val free : t -> unit

Free a plugin immediately, this isn't normally required unless there are a lot of plugins open at once

val reset : t -> bool

Reset the Extism runtime, this will invalidate all allocated memory

val function_exists : t -> string -> bool

Check if a function is exported by a plugin

module Cancel_handle : sig ... end
val cancel_handle : t -> Cancel_handle.t
val id : t -> Uuidm.t

Get the plugin UUID

module Typed : sig ... end

Typed plugins allow for plugin functions to be check at initialization and called with static types

OCaml

Innovation. Community. Security.