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

A reader for the code section of a WebAssembly module.

Implementations

Constructs a new CodeSectionReader for the given data and offset.

Gets the original position of the reader.

Gets the count of items in the section.

Reads content of the code section.

Examples
use wasmparser::CodeSectionReader;
let mut code_reader = CodeSectionReader::new(data, 0).unwrap();
for _ in 0..code_reader.get_count() {
    let body = code_reader.read().expect("function body");
    let mut binary_reader = body.get_binary_reader();
    assert!(binary_reader.read_var_u32().expect("local count") == 0);
    let op = binary_reader.read_operator().expect("first operator");
    println!("First operator: {:?}", op);
}

Trait Implementations

Implements iterator over the code section.

Examples
use wasmparser::CodeSectionReader;
let mut code_reader = CodeSectionReader::new(data, 0).unwrap();
for body in code_reader {
    let mut binary_reader = body.expect("b").get_binary_reader();
    assert!(binary_reader.read_var_u32().expect("local count") == 0);
    let op = binary_reader.read_operator().expect("first operator");
    println!("First operator: {:?}", op);
}

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

The item returned by the reader.

Reads an item from the section.

Determines if the reader is at end-of-section.

Gets the original position of the reader.

Gets the range of the reader.

Ensures the reader is at the end of the section. Read more

Gets the count of the items in the section.

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.