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

Function WithModuleInstance

module.go:219–221  ·  view source on GitHub ↗

WithModuleInstance returns a Go context inheriting from ctx and containing the state needed for module instantiated from wazero host module to properly bind their methods to their receiver (e.g. the module instance). Use this function when calling methods of an instantiated WebAssenbly module which

(ctx context.Context, ins *ModuleInstance[T])

Source from the content-addressed store, hash-verified

217// ...
218// }
219func WithModuleInstance[T Module](ctx context.Context, ins *ModuleInstance[T]) context.Context {
220 return context.WithValue(ctx, (*ModuleInstance[T])(nil), ins.instance)
221}

Callers 3

CallMethod · 0.85
CallWithStackMethod · 0.85

Calls

no outgoing calls

Tested by 1