Clarify Runtime implements Namespace in ModuleBuilder.Instantiate godoc (#651)

Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
This commit is contained in:
Anuraag Agrawal
2022-06-22 17:55:20 +09:00
committed by GitHub
parent 4136a360ac
commit 53f0c018a6

View File

@@ -174,6 +174,19 @@ type ModuleBuilder interface {
// Instantiate is a convenience that calls Compile, then Namespace.InstantiateModule.
//
// Ex.
//
// ctx := context.Background()
// r := wazero.NewRuntime()
// defer r.Close(ctx) // This closes everything this Runtime created.
//
// hello := func() {
// fmt.Fprintln(stdout, "hello!")
// }
// env, _ := r.NewModuleBuilder("env").
// ExportFunction("hello", hello).
// Instantiate(ctx, r)
//
// Notes
//
// * Closing the Namespace has the same effect as closing the result.