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§

  • collectionsvalidate
    Type definitions for maps and sets used by the wasmparser crate.
  • component_typesvalidate and component-model
    Types relating to type information provided by validation.
  • namesvalidate and component-model
    Definitions of name-related helpers and newtypes, primarily for the component model.
  • typesvalidate
    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§

Enums§

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.
  • To compute the arity (param and result counts) of “variable-arity” operators, the operator_arity macro needs information about the module’s types and the current control stack. The ModuleArity trait exposes this information.
  • A trait implemented for subsections of another outer section.
  • Trait implemented by types that can visit all Operator variants.
  • Types that qualify as Wasm validation database.

Functions§

  • validatevalidate
    Test whether the given buffer contains a valid WebAssembly module or component, analogous to WebAssembly.validate in the JS API.

Type Aliases§