wazeroexec

package
v0.0.0-...-6554945 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2022 License: MIT Imports: 4 Imported by: 0

README

wazeroexec

This package provides an import hook for wazero. See the example directory for a working implementation.

Usage:

import "github.com/prep/wasmexec/wazeroexec"
err := wazeroexec.Import(ctx, runtime, instance)

Or if you want to import these functions on your namespace:

err := wazeroexec.ImportWithNamespace(ctx, runtime, ns, instance)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Import

func Import(ctx context.Context, runtime wazero.Runtime, instance wasmexec.Instance) (*wasmexec.Module, error)

Import the Go JavaScript functions.

func ImportWithNamespace

func ImportWithNamespace(ctx context.Context, runtime wazero.Runtime, ns wazero.Namespace, instance wasmexec.Instance) (*wasmexec.Module, error)

ImportWithNamespace imports the Go JavaScript functions in this namespace.

Types

type Memory

type Memory struct {
	api.Memory
}

Memory wraps a wazero Memory module and slaps on top of it the getter and setter functions that the wasmexec runtime needs.

func NewMemory

func NewMemory(mem api.Memory) *Memory

NewMemory returns a new Memory.

func (*Memory) GetFloat64

func (mem *Memory) GetFloat64(offset uint32) (float64, error)

func (*Memory) GetInt64

func (mem *Memory) GetInt64(offset uint32) (int64, error)

func (*Memory) GetUInt32

func (mem *Memory) GetUInt32(offset uint32) (uint32, error)

func (*Memory) Range

func (mem *Memory) Range(offset, length uint32) ([]byte, error)

func (*Memory) SetFloat64

func (mem *Memory) SetFloat64(offset uint32, val float64) error

func (*Memory) SetInt64

func (mem *Memory) SetInt64(offset uint32, val int64) error

func (*Memory) SetUInt32

func (mem *Memory) SetUInt32(offset, val uint32) error

func (*Memory) SetUInt8

func (mem *Memory) SetUInt8(offset uint32, val uint8) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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