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.
| 18 | // HostModule instances are expected to be immutable and therfore safe to use |
| 19 | // concurrently from multiple goroutines. |
| 20 | type 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 |
no outgoing calls
no test coverage detected