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.


  • collectionsvalidate
    Type definitions for maps and sets used by the wasmparser crate.
  • namesvalidate
    Definitions of name-related helpers and newtypes, primarily for the component model.
  • typesvalidate
    Types relating to type information provided by validation.


  • 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.




  • 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 validation database.


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

Type Aliases§