MCPcopy Index your code
hub / github.com/dispatchrun/wazergo / HostModule

Interface HostModule

module.go:20–31  ·  view source on GitHub ↗

HostModule is an interface representing type-safe wazero host modules. The interface is parametrized on the module type that it instantiates. HostModule instances are expected to be immutable and therfore safe to use concurrently from multiple goroutines.

Source from the content-addressed store, hash-verified

18// HostModule instances are expected to be immutable and therfore safe to use
19// concurrently from multiple goroutines.
20type HostModule[T Module] interface {
21 // Returns the name of the host module (e.g. "wasi_snapshot_preview1").
22 Name() string
23 // Returns the collection of functions exported by the host module.
24 // The method may return the same value across multiple calls to this
25 // method, the program is expected to treat it as a read-only value.
26 Functions() Functions[T]
27 // Creates a new instance of the host module type, using the list of options
28 // passed as arguments to configure it. This method is intended to be called
29 // automatically when instantiating a module via an instantiation context.
30 Instantiate(ctx context.Context, options ...Option[T]) (T, error)
31}
32
33// Build builds the host module p in the wazero runtime r, returning the
34// instance of HostModuleBuilder that was created. This is a low level function

Callers 11

BuildFunction · 0.65
InstantiateMethod · 0.65
DecorateFunction · 0.65
NameMethod · 0.65
formatUnsupportedFunction · 0.65
BuildFunction · 0.65
DecorateFunction · 0.65
InstantiateMethod · 0.65
InstantiateFunction · 0.65
loadModuleFunction · 0.65
InstantiateMethod · 0.65

Implementers 1

pluginfunction_test.go

Calls

no outgoing calls

Tested by

no test coverage detected