wasm

package
v0.20.21 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer uint64

func FromSlice

func FromSlice(value []byte) Buffer

func (Buffer) Address

func (buffer Buffer) Address() uint32

func (Buffer) Length

func (buffer Buffer) Length() uint32

func (Buffer) Slice

func (buffer Buffer) Slice() []byte

Slice returns a copy of the data from the underlying Buffer by reading the data at the buffer address for its length. Once read, the buffer is safe to be freed.

func (Buffer) String

func (buffer Buffer) String() string

type Ptr

type Ptr uint32

func PtrTo

func PtrTo[T any](value *T) Ptr

type State

type State uint32

State is used to convey the state of a host module function call. Given that a host function will generally do something the wasm module cannot do, it will likely do some sort of IO. This means that the call can either succeed or fail with some error. This allows us to interpret the returned memory buffer as either containing a value or an error.

State is a uint32 allowing us to define well-known generic errors that packages can use to express semantic meaning. It is not exhaustive. As new use cases are added, we can add new semantic errors.

Currently the only host function we expose is k8s.Lookup, this means means the host function can set any of the below states and the k8s package can use them to return meaningful error types to the user that they can in turn act upon.

const (
	StateOK State = iota
	StateFeatureNotGranted
	StateError
	StateNotFound
	StateUnauthenticated
	StateForbidden
)

type String

type String uint64

func FromString

func FromString(value string) String

Directories

Path Synopsis
module serves to manipulate wasm module binaries and interact with them.
module serves to manipulate wasm module binaries and interact with them.

Jump to

Keyboard shortcuts

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