pub struct CodeSectionReader<'a> { /* fields omitted */ }
Reads content of the code section.
use wasmparser::ModuleReader;
let mut reader = ModuleReader::new(data).expect("module reader");
let section = reader.read().expect("type section");
let section = reader.read().expect("function section");
let section = reader.read().expect("code section");
let mut code_reader = section.get_code_section_reader().expect("code section reader");
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_local_count().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?
Implements iterator over the code section.
use wasmparser::ModuleReader;
let mut reader = ModuleReader::new(data).expect("module reader");
let section = reader.read().expect("type section");
let section = reader.read().expect("function section");
let section = reader.read().expect("code section");
let mut code_reader = section.get_code_section_reader().expect("code section reader");
for body in code_reader {
let mut binary_reader = body.expect("b").get_binary_reader();
assert!(binary_reader.read_local_count().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?
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)