Compile compiles a wazero host module within the given context.
(ctx context.Context, runtime wazero.Runtime, mod HostModule[T])
| 88 | |
| 89 | // Compile compiles a wazero host module within the given context. |
| 90 | func 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. |
| 99 | func MustCompile[T Module](ctx context.Context, runtime wazero.Runtime, mod HostModule[T]) *CompiledModule[T] { |