package extism

  1. Overview
  2. Docs

Defines the interface for typed plugins

type plugin := t
type t

Opaque typed plugin type

val of_plugin : plugin -> (t, Error.t) Stdlib.result

Load an instance of a typed plugin, returning a result

val of_plugin_exn : plugin -> t

Load an instance of a typed plugin, raising an exception if an error occurs

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

Pre-declare a function that returns a result type

val exn : (t -> 'a -> ('b, Error.t) Stdlib.result) -> t -> 'a -> 'b

Convert a pre-declared function to raise an exception instead of a result type