Documentation
¶
Index ¶
- Constants
- func Write(w io.Writer, sections []Section) error
- func WriteModuleHeader(w io.Writer) error
- func WriteSectionHeader(w io.Writer, id SectionID, size uint64) (n int, err error)
- func WriteString(w io.Writer, s string) (n int, err error)
- type CustomSection
- type LinkingSection
- type Section
- type SectionID
Constants ¶
View Source
const ( Magic = "\x00asm" Version1 = "\x01\x00\x00\x00" )
Variables ¶
This section is empty.
Functions ¶
func Write ¶
Write writes a binary WebAssembly module to w.
func WriteModuleHeader ¶
WriteModuleHeader writes a binary WebAssembly module header (version 1) to w.
func WriteSectionHeader ¶
WriteSectionHeader writes a binary WebAssembly section header to w. It returns the number of bytes written and/or an error.
Types ¶
type CustomSection ¶
CustomSection represents a WebAssembly custom section.
func (*CustomSection) SectionContents ¶
func (s *CustomSection) SectionContents() ([]byte, error)
SectionContents implements the Section interface.
func (*CustomSection) SectionID ¶
func (*CustomSection) SectionID() SectionID
SectionID implements the Section interface.
type LinkingSection ¶
type LinkingSection struct{}
func (*LinkingSection) SectionContents ¶
func (s *LinkingSection) SectionContents() ([]byte, error)
SectionContents implements the Section interface.
func (*LinkingSection) SectionID ¶
func (*LinkingSection) SectionID() SectionID
SectionID implements the Section interface.
type Section ¶
type Section interface {
// SectionID returns the section ID of this section.
SectionID() SectionID
// SectionContents returns the section contents as a byte slice.
SectionContents() ([]byte, error)
}
Section represents an abstract WebAssembly section.
type SectionID ¶
type SectionID uint8
SectionID represents a WebAssembly section SectionID.
const ( SectionCustom SectionID = 0 SectionType SectionID = 1 SectionImport SectionID = 2 SectionFunction SectionID = 3 SectionTable SectionID = 4 SectionMemory SectionID = 5 SectionGlobal SectionID = 6 SectionExport SectionID = 7 SectionStart SectionID = 8 SectionElement SectionID = 9 SectionCode SectionID = 10 SectionData SectionID = 11 SectionDataCount SectionID = 12 )
Click to show internal directories.
Click to hide internal directories.