pub struct ModuleReader<'a> { /* private fields */ }
Expand description

Reads top-level WebAssembly file structure: header and sections.

Implementations

Reads next top-level record from the WebAssembly binary data. The methods returns reference to current state of the reader.

Examples
use wasmparser::ModuleReader;
let mut reader = ModuleReader::new(data).expect("reader");
let section = reader.read().expect("section #1");
println!("First section {:?}", section);
let section = reader.read().expect("section #2");
println!("Second section {:?}", section);
assert!(!reader.eof(), "there are more sections");

Skips custom sections.

Examples
use wasmparser::ModuleReader;
use wasmparser::SectionCode;
let mut reader = ModuleReader::new(data).expect("reader");
while { reader.skip_custom_sections(); !reader.eof() } {
    let section = reader.read().expect("section");
    if let SectionCode::Custom {..} = section.code { panic!("no custom"); }
    println!("Section {:?}", section);
}

Trait Implementations

The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.