Crate wasmparser

source ·
Expand description

A simple event-driven library for parsing WebAssembly binary files (or streams).

The parser library reports events as they happen and only stores parsing information for a brief period of time, making it very fast and memory-efficient. The event-driven model, however, has some drawbacks. If you need random access to the entire WebAssembly data-structure, this is not the right library for you. You could however, build such a data-structure using this library.

To get started, create a Parser using Parser::new and then follow the examples documented for Parser::parse or Parser::parse_all.

Modules§

  • Definitions of name-related helpers and newtypes, primarily for the component model.
  • Types relating to type information provided by validation.

Macros§

  • A helper macro to conveniently iterate over all opcodes recognized by this crate. This can be used to work with either the Operator enumeration or the VisitOperator trait if your use case uniformly handles all operators the same way.

Structs§

  • Represents a type of an array in a WebAssembly module.
  • A binary reader of the WebAssembly structures and types.
  • A binary reader for WebAssembly modules.
  • A br_table entries representation.
  • Represents an export in a WebAssembly component.
  • Represents the name of a component export.
  • Represents a type of a function in a WebAssembly component.
  • Represents an import in a WebAssembly component
  • Represents the name of a component import.
  • Represents an argument to instantiating a WebAssembly component.
  • Represents the start function in a WebAssembly component.
  • Represents an initialization expression.
  • A single instance from a coredump instances section
  • A custom section representing the instances involved in a given coredump
  • The data portion of a “coremodules” custom section. This contains a vec of module names that will be referenced by index by other coredump sections.
  • The data portion of a custom section representing a core dump. Per the tool-conventions repo, this section just specifies the executable name that the core dump came from while the rest of the core dump information is contained in a corestack custom section
  • A single stack frame from a core dump
  • The data portion of a custom section representing a core dump stack. The structure of this follows the coredump spec in the tool-conventions repo
  • A reader for custom sections of a WebAssembly module.
  • Represents a data segment in a core WebAssembly module.
  • Represents a core WebAssembly element segment.
  • Represents an export in a WebAssembly module.
  • Represents a field type of an array or a struct.
  • A Wasm control flow block on the control flow stack during Wasm validation.
  • Resources necessary to perform validation of a function.
  • Represents a type of a function in a WebAssembly module.
  • Validation context for a WebAssembly function.
  • External handle to the internal allocations used during function validation.
  • Represents a WebAssembly function body.
  • Represents a core WebAssembly global.
  • Represents a global’s type.
  • An IEEE binary32 immediate floating point value, represented as a u32 containing the bit pattern.
  • An IEEE binary64 immediate floating point value, represented as a u64 containing the bit pattern.
  • Represents an import in a WebAssembly module.
  • Represents an indirect name in the names custom section.
  • Represents an argument to instantiating a WebAssembly module.
  • An iterator over locals in a function body.
  • A reader for a function body’s locals.
  • Represents a memory immediate in a WebAssembly memory instruction.
  • Represents a WASM_DYLINK_MEM_INFO field
  • Represents a memory’s type.
  • Represents a name for an index from the names section.
  • An iterator over a function’s operators.
  • An iterator over a function’s operators with offsets.
  • A reader for a core WebAssembly function’s operators.
  • A packed representation of a type index.
  • An incremental parser of a binary WebAssembly module or component.
  • A field from the producers custom section.
  • Represents a field value in the producers custom section.
  • Represents a recursive type group in a WebAssembly module.
  • A reference type.
  • A generic structure for reading a section of a WebAssembly binary which has a limited number of items within it.
  • A consuming iterator of a SectionLimited.
  • An iterator over a limited section iterator.
  • Represents a type of a struct in a WebAssembly module.
  • Represents a subtype of possible other types in a WebAssembly module.
  • Iterator/reader over the contents of a section which is composed of subsections.
  • Type information about a table defined in the table section of a WebAssembly module.
  • Represents a table’s type.
  • A tag’s type.
  • Represents a 128-bit vector value.
  • Validator for a WebAssembly binary module or component.
  • The implementation of WasmModuleResources used by Validator.
  • Represents a case in a variant type.
  • Flags for features that are enabled for validation.
  • Iterator over the inputs of a Wasm function type.
  • Iterator over the outputs of a Wasm function type.

Enums§

Constants§

Traits§

  • A trait implemented for items that can be decoded directly from a BinaryReader, or that which can be parsed from the WebAssembly binary format.
  • A trait implemented for subsections of another outer section.
  • Trait implemented by types that can visit all Operator variants.
  • Types that qualify as Wasm function types for validation purposes.
  • Types that qualify as Wasm validation database.

Functions§

Type Aliases§