binary

package
v1.0.0-pre.1 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidByte           = errors.New("invalid byte")
	ErrInvalidMagicNumber    = errors.New("invalid magic number")
	ErrInvalidVersion        = errors.New("invalid version header")
	ErrInvalidSectionID      = errors.New("invalid section id")
	ErrCustomSectionNotFound = errors.New("custom section not found")
)
View Source
var Magic = []byte{0x00, 0x61, 0x73, 0x6D}

Magic is the 4 byte preamble (literally "\0asm") of the binary format See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-magic

Functions

func DecodeModule

func DecodeModule(
	binary []byte,
	enabledFeatures wasm.Features,
	memorySizer func(minPages uint32, maxPages *uint32) (min, capacity, max uint32),
) (*wasm.Module, error)

DecodeModule implements wasm.DecodeModule for the WebAssembly 1.0 (20191205) Binary Format See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-format%E2%91%A0

func EncodeModule

func EncodeModule(m *wasm.Module) (bytes []byte)

EncodeModule implements wasm.EncodeModule for the WebAssembly 1.0 (20191205) Binary Format. Note: If saving to a file, the conventional extension is wasm See https://www.w3.org/TR/2019/REC-wasm-core-1-20191205/#binary-format%E2%91%A0

Types

This section is empty.

Jump to

Keyboard shortcuts

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