MCPcopy Create free account
hub / github.com/dispatchrun/wazergo / Compile

Function Compile

module.go:90–96  ·  view source on GitHub ↗

Compile compiles a wazero host module within the given context.

(ctx context.Context, runtime wazero.Runtime, mod HostModule[T])

Source from the content-addressed store, hash-verified

88
89// Compile compiles a wazero host module within the given context.
90func Compile[T Module](ctx context.Context, runtime wazero.Runtime, mod HostModule[T]) (*CompiledModule[T], error) {
91 compiledModule, err := Build(runtime, mod).Compile(ctx)
92 if err != nil {
93 return nil, err
94 }
95 return &CompiledModule[T]{mod, compiledModule, runtime}, nil
96}
97
98// MustCompile is like Compile but it panics if there is an error.
99func MustCompile[T Module](ctx context.Context, runtime wazero.Runtime, mod HostModule[T]) *CompiledModule[T] {

Callers 1

MustCompileFunction · 0.85

Calls 1

BuildFunction · 0.85

Tested by

no test coverage detected