[][src]Struct wit_parser::Parser

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

Top-level parser for the WebAssembly Interface Types binary section.

This Parser is used to iterate over Section instances to learn about each section in the binary format.


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

pub fn new(offset: usize, bytes: &'a [u8]) -> Result<Parser<'a>>[src]

Creates a new Parser from the given binary blob.

Currently the binary blob is expected to be the payload of a custom section called wasm-interface-types. This will almost surely change in the future.

The offset argument is the offset in which bytes was found in the original binary file, used to generate error messages.

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

Returns if there are no more bytes to parse in this Parser, and all sections have been read.

pub fn section(&mut self) -> Result<Section<'a>>[src]

Attempts to parse the next Section from this Parser.

Returns an error if this parser cannot be advanced to parse another section. Note that the section itself will not be fully parsed, but rather it will return a placeholder which be further used to parse the contents of the section.

Trait Implementations

impl<'a> Clone for Parser<'a>[src]

Auto Trait Implementations

impl<'a> Send for Parser<'a>

impl<'a> Sync for Parser<'a>

impl<'a> Unpin for Parser<'a>

impl<'a> UnwindSafe for Parser<'a>

impl<'a> RefUnwindSafe for Parser<'a>

Blanket Implementations

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

impl<T> BorrowMut<T> for T where
    T: ?Sized

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