[][src]Struct wasmparser::ModuleReader

pub struct ModuleReader<'a> { /* fields omitted */ }

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

Methods

impl<'a> ModuleReader<'a>[src]

pub fn new(data: &[u8]) -> Result<ModuleReader>[src]

pub fn get_version(&self) -> u32[src]

pub fn current_position(&self) -> usize[src]

pub fn eof(&self) -> bool[src]

pub fn read<'b>(&mut self) -> Result<Section<'b>> where
    'a: 'b, 
[src]

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");

pub fn skip_custom_sections(&mut self) -> Result<()>[src]

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

impl<'a> IntoIterator for ModuleReader<'a>[src]

type Item = Result<Section<'a>>

The type of the elements being iterated over.

type IntoIter = ModuleIterator<'a>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<'a> Sync for ModuleReader<'a>

impl<'a> Unpin for ModuleReader<'a>

impl<'a> Send for ModuleReader<'a>

impl<'a> UnwindSafe for ModuleReader<'a>

impl<'a> RefUnwindSafe for ModuleReader<'a>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]