wasmguest

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package wasmguest calls into one instance of a single-purpose WebAssembly engine the way filex's engines are driven (internal/thumb/svgwasm, the SVG rasteriser; internal/templates/sandbox, the template engine): put the input into the guest's memory, call its exports, read the answer back.

The first error sticks and every call after it is a no-op, so a render reads as a straight line and is checked once, at the end.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Guest

type Guest struct {
	Ctx context.Context
	Mod api.Module
	Err error
}

Guest is one instance being called. Err is the first thing that failed.

func (*Guest) Call

func (g *Guest) Call(name string, args ...uint64) uint64

Call calls the export name with args and returns its first result (0 when it has none, or after an error).

func (*Guest) Put

func (g *Guest) Put(alloc string, b []byte) uint64

Put asks the guest for len(b) bytes through its export alloc (one argument, the length; it answers the address) and writes b there.

func (*Guest) Read

func (g *Guest) Read(p, n uint64) []byte

Read copies n bytes at p out of the guest's memory.

Jump to

Keyboard shortcuts

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