pub struct Parser { /* private fields */ }Expand description
Parser configuration for transforming bytes into WebAssembly binaries.
Implementations§
Source§impl Parser
impl Parser
Sourcepub fn generate_dwarf(&mut self, generate: GenerateDwarf) -> &mut Self
Available on crate feature dwarf only.
pub fn generate_dwarf(&mut self, generate: GenerateDwarf) -> &mut Self
dwarf only.Indicates that DWARF debugging information should be generated and emitted by default.
Note that DWARF debugging information is only emitted for textual-based
modules. For example if a WebAssembly binary is parsed via
Parser::parse_bytes this won’t insert new DWARF information in such
a binary. Additionally if the text format used the (module binary ...)
form then no DWARF information will be emitted.
Sourcepub fn parse_file(&self, path: impl AsRef<Path>) -> Result<Vec<u8>>
pub fn parse_file(&self, path: impl AsRef<Path>) -> Result<Vec<u8>>
Equivalent of parse_file but uses this parser’s settings.
Sourcepub fn parse_bytes<'a>(
&self,
path: Option<&Path>,
bytes: &'a [u8],
) -> Result<Cow<'a, [u8]>>
pub fn parse_bytes<'a>( &self, path: Option<&Path>, bytes: &'a [u8], ) -> Result<Cow<'a, [u8]>>
Equivalent of parse_bytes but uses this parser’s settings.
The path argument is an optional path to use when error messages are
generated.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Parser
impl RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnwindSafe for Parser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more