wazero

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsExitError

func AsExitError(err error) (exitCode int, ok bool)

func JsInstantiate added in v0.9.0

func JsInstantiate(ctx context.Context, rt wazero.Runtime) (api.Closer, error)

func RunWasm

func RunWasm(wasmName string, wasmBytes []byte, mainFunc string, wasmArgs ...string) (stdout, stderr []byte, err error)

单次执行 wasm

func UnknownInstantiate added in v0.9.0

func UnknownInstantiate(ctx context.Context, rt wazero.Runtime) (api.Closer, error)

func WasiInstantiate

func WasiInstantiate(ctx context.Context, rt wazero.Runtime) (api.Closer, error)

func Wat2Wasm added in v0.13.0

func Wat2Wasm(source []byte) ([]byte, error)

Types

type Module

type Module struct {
	// contains filtered or unexported fields
}

wasm 模块, 可多次执行

func BuildModule

func BuildModule(wasmName string, wasmBytes []byte, wasmArgs ...string) (*Module, error)

构建模块(会执行编译)

func (*Module) Close

func (p *Module) Close() error

关闭模块

func (*Module) RunFunc

func (p *Module) RunFunc(name string, args ...uint64) (result []uint64, stdout, stderr []byte, err error)

执行指定函数(init会被强制执行一次)

func (*Module) RunMain

func (p *Module) RunMain(mainFunc string) (stdout, stderr []byte, err error)

执行初始化, 仅执行一次

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL