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

A reader for a core WebAssembly function’s operators.

Implementations§

Determines if the reader is at the end of the operators.

Gets the original position of the reader.

Whether or not to allow 64-bit memory arguments in the the operators being read.

This is intended to be true when support for the memory64 WebAssembly proposal is also enabled.

Ensures the reader is at the end.

This function returns an error if there is extra data after the operators.

Reads an operator from the reader.

Converts to an iterator of operators paired with offsets.

Reads an operator with its offset.

Visit a single operator with the specified VisitOperator instance.

See BinaryReader::visit_operator for more information.

Gets a binary reader from this operators reader.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Reads content of the code section.

Examples
use wasmparser::{Operator, CodeSectionReader, Result};
let code_reader = CodeSectionReader::new(data, 0).unwrap();
for body in code_reader {
    let body = body.expect("function body");
    let mut op_reader = body.get_operators_reader().expect("op reader");
    let ops = op_reader.into_iter().collect::<Result<Vec<Operator>>>().expect("ops");
    assert!(
        if let [Operator::Nop, Operator::End] = ops.as_slice() { true } else { false },
        "found {:?}",
        ops
    );
}
The type of the elements being iterated over.
Which kind of iterator are we turning this into?

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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.