Struct wasmparser::ValidatingOperatorParser
source · pub struct ValidatingOperatorParser<'b> { /* private fields */ }
Implementations
sourceimpl<'b> ValidatingOperatorParser<'b>
impl<'b> ValidatingOperatorParser<'b>
pub fn eof(&self) -> bool
pub fn current_position(&self) -> usize
pub fn is_dead_code(&self) -> bool
sourcepub fn next(
&mut self,
resources: &dyn WasmModuleResources
) -> Result<Operator<'b>>
pub fn next(
&mut self,
resources: &dyn WasmModuleResources
) -> Result<Operator<'b>>
Creates a BinaryReader when current state is ParserState::BeginSection or ParserState::BeginFunctionBody.
Examples
use wasmparser::{WasmDecoder, ParserState, ValidatingParser};
let mut parser = ValidatingParser::new(data, None);
let mut validating_parsers = Vec::new();
loop {
{
match *parser.read() {
ParserState::Error(_) |
ParserState::EndWasm => break,
ParserState::BeginFunctionBody {..} => (),
_ => continue
}
}
let reader = parser.create_validating_operator_parser();
validating_parsers.push(reader);
}
for (i, reader) in validating_parsers.iter_mut().enumerate() {
println!("Function {}", i);
while !reader.eof() {
let read = reader.next(&parser);
if let Ok(ref op) = read {
println!(" {:?}", op);
} else {
panic!(" Bad wasm code {:?}", read.err());
}
}
}
Auto Trait Implementations
impl<'b> RefUnwindSafe for ValidatingOperatorParser<'b>
impl<'b> Send for ValidatingOperatorParser<'b>
impl<'b> Sync for ValidatingOperatorParser<'b>
impl<'b> Unpin for ValidatingOperatorParser<'b>
impl<'b> UnwindSafe for ValidatingOperatorParser<'b>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more