wasm

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Magic is the wasm file magic number.
	Magic = 0x6d736100 // \0asm
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FunctionImport

type FunctionImport struct {
	Index uint32
}

type GlobalImport

type GlobalImport struct {
	ContentType int8
	Mutable     bool
}
type Header struct {
	Magic   binary.U32le[uint32]
	Version binary.U32le[uint32]
}

func (*Header) Decode

func (h *Header) Decode(data []byte) (next []byte, ok bool)

type ImportEntry

type ImportEntry struct {
	Module string
	Field  string

	Kind ImportKind

	Function FunctionImport
	Table    TableImport
	Memory   MemoryImport
	Global   GlobalImport
}

func (*ImportEntry) Parse

func (e *ImportEntry) Parse(data []byte) (next []byte, ok bool)

type ImportKind

type ImportKind uint8
const (
	ImportKindFunction ImportKind = iota
	ImportKindTable
	ImportKindMemory
	ImportKindGlobal
)

type ImportSection

type ImportSection struct {
	// Entries is the count of import entries to decode.
	Entries uint32
}

func (*ImportSection) Decode

func (sect *ImportSection) Decode(data []byte) (next []byte, ok bool)

type MemoryImport

type MemoryImport struct {
	Limits ResizableLimits
}

type ResizableLimits

type ResizableLimits struct {
	Initial uint32
	Maximum uint32
}

func (*ResizableLimits) Parse

func (l *ResizableLimits) Parse(data []byte) (next []byte, ok bool)

type Section

type Section struct {
	ID   SectionID
	Data []byte
}

func (*Section) Decode

func (sect *Section) Decode(data []byte) (next []byte, ok bool)

type SectionID

type SectionID byte
const (
	Section_CUSTOM SectionID = iota
	Section_TYPE
	Section_IMPORT
	Section_FUNCTION
	Section_TABLE
	Section_MEMORY
	Section_GLOBAL
	Section_EXPORT
	Section_START
	Section_ELEMENT
	Section_CODE
	Section_DATA
	Section_DATA_COUNT
)

type TableImport

type TableImport struct {
	ElemType int8
	Limits   ResizableLimits
}

Jump to

Keyboard shortcuts

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