wasm_encoder::reencode::utils

Function intersperse_section_hook

Source
pub fn intersperse_section_hook<T: ?Sized + Reencode>(
    _reencoder: &mut T,
    _module: &mut Module,
    _after: Option<SectionId>,
    _before: Option<SectionId>,
) -> Result<(), Error<T::Error>>
Available on crate feature wasmparser only.
Expand description

A hook method that is called inside Reencode::parse_core_module before and after every non-custom core wasm section.

This method can be used to insert new custom sections in between those sections, or to detect when a non-custom section is missing and insert it in the proper order.

The after parameter is None iff the hook is called before the first non-custom section, and Some(s) afterwards, where s is the SectionId of the previous non-custom section.

The before parameter is None iff the hook is called after the last non-custom section, and Some(s) beforehand, where s is the SectionId of the following non-custom section.