pub struct Module(/* private fields */);Expand description
Represents WebAssembly module. Use new to build from buffer.
Implementations§
Source§impl Module
impl Module
Sourcepub fn sections(&self) -> Result<impl Iterator<Item = Section<'_>>>
pub fn sections(&self) -> Result<impl Iterator<Item = Section<'_>>>
Returns an iterator over the module’s custom sections.
Sections are always yielded as the Any variant (borrowed). They
can be parsed with Section::to().
Sourcepub fn set_section(&mut self, section: Section<'_>) -> Option<()>
pub fn set_section(&mut self, section: Section<'_>) -> Option<()>
Sets the payload associated with the given custom section, or adds a new custom section, as appropriate.
Sourcepub fn clear_section(
&mut self,
name: impl AsRef<str>,
) -> Option<Section<'static>>
pub fn clear_section( &mut self, name: impl AsRef<str>, ) -> Option<Section<'static>>
Removes the given custom section, if it exists. Returns the removed section if it existed, or None otherwise.
Sourcepub fn into_buffer(self) -> Result<Vec<u8>>
pub fn into_buffer(self) -> Result<Vec<u8>>
Write out module to a Vec of bytes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Module
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnsafeUnpin for Module
impl UnwindSafe for Module
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