Skip to main content

Generator

Trait Generator 

Source
pub trait Generator: Debug + Any {
    // Provided methods
    fn pre_vfs(&mut self, module: &mut Module, ctx: &GeneratorCtx) -> Result<()> { ... }
    fn pre_target(
        &mut self,
        module: &mut Module,
        ctx: &GeneratorCtx,
        external: &ModuleExternal,
    ) -> Result<()> { ... }
    fn post_combine(
        &mut self,
        module: &mut Module,
        ctx: &GeneratorCtx,
    ) -> Result<()> { ... }
    fn post_lower_memory(
        &mut self,
        module: &mut Module,
        ctx: &GeneratorCtx,
    ) -> Result<()> { ... }
    fn post_components(
        &mut self,
        module: &mut Module,
        ctx: &ComponentCtx,
    ) -> Result<()> { ... }
    fn post_all_optimize(
        &mut self,
        module: &mut Module,
        ctx: &ComponentCtx,
    ) -> Result<bool> { ... }
}
Expand description

Defines the core trait for WASM transformations, hooks, and component optimizations over the build lifecycle.

Provided Methods§

Source

fn pre_vfs(&mut self, module: &mut Module, ctx: &GeneratorCtx) -> Result<()>

Operations performed on the built VFS module.

Source

fn pre_target( &mut self, module: &mut Module, ctx: &GeneratorCtx, external: &ModuleExternal, ) -> Result<()>

Operations performed on the target module.

Source

fn post_combine( &mut self, module: &mut Module, ctx: &GeneratorCtx, ) -> Result<()>

Operations performed on the combined module.

Source

fn post_lower_memory( &mut self, module: &mut Module, ctx: &GeneratorCtx, ) -> Result<()>

Operations performed after lowerings memory operations. Only called if the target memory type is Single.

Source

fn post_components( &mut self, module: &mut Module, ctx: &ComponentCtx, ) -> Result<()>

Operations performed after components.

Source

fn post_all_optimize( &mut self, module: &mut Module, ctx: &ComponentCtx, ) -> Result<bool>

Operations performed after last optimizations. Generating debug functions is a delicate process, so in this case, output once per structure. Return true if there are changes.

Trait Implementations§

Source§

impl<'a> Generator for &'a mut (dyn Generator + 'a)

Source§

fn pre_vfs(&mut self, module: &mut Module, ctx: &GeneratorCtx) -> Result<()>

Operations performed on the built VFS module.
Source§

fn pre_target( &mut self, module: &mut Module, ctx: &GeneratorCtx, external: &ModuleExternal, ) -> Result<()>

Operations performed on the target module.
Source§

fn post_combine( &mut self, module: &mut Module, ctx: &GeneratorCtx, ) -> Result<()>

Operations performed on the combined module.
Source§

fn post_lower_memory( &mut self, module: &mut Module, ctx: &GeneratorCtx, ) -> Result<()>

Operations performed after lowerings memory operations. Only called if the target memory type is Single.
Source§

fn post_components( &mut self, module: &mut Module, ctx: &ComponentCtx, ) -> Result<()>

Operations performed after components.
Source§

fn post_all_optimize( &mut self, module: &mut Module, ctx: &ComponentCtx, ) -> Result<bool>

Operations performed after last optimizations. Generating debug functions is a delicate process, so in this case, output once per structure. Return true if there are changes.
Source§

impl Generator for Box<dyn Generator + 'static>

Source§

fn pre_vfs(&mut self, module: &mut Module, ctx: &GeneratorCtx) -> Result<()>

Operations performed on the built VFS module.
Source§

fn pre_target( &mut self, module: &mut Module, ctx: &GeneratorCtx, external: &ModuleExternal, ) -> Result<()>

Operations performed on the target module.
Source§

fn post_combine( &mut self, module: &mut Module, ctx: &GeneratorCtx, ) -> Result<()>

Operations performed on the combined module.
Source§

fn post_lower_memory( &mut self, module: &mut Module, ctx: &GeneratorCtx, ) -> Result<()>

Operations performed after lowerings memory operations. Only called if the target memory type is Single.
Source§

fn post_components( &mut self, module: &mut Module, ctx: &ComponentCtx, ) -> Result<()>

Operations performed after components.
Source§

fn post_all_optimize( &mut self, module: &mut Module, ctx: &ComponentCtx, ) -> Result<bool>

Operations performed after last optimizations. Generating debug functions is a delicate process, so in this case, output once per structure. Return true if there are changes.

Implementations on Foreign Types§

Source§

impl Generator for Box<dyn Generator + 'static>

Source§

fn pre_vfs(&mut self, module: &mut Module, ctx: &GeneratorCtx) -> Result<()>

Source§

fn pre_target( &mut self, module: &mut Module, ctx: &GeneratorCtx, external: &ModuleExternal, ) -> Result<()>

Source§

fn post_combine( &mut self, module: &mut Module, ctx: &GeneratorCtx, ) -> Result<()>

Source§

fn post_lower_memory( &mut self, module: &mut Module, ctx: &GeneratorCtx, ) -> Result<()>

Source§

fn post_components( &mut self, module: &mut Module, ctx: &ComponentCtx, ) -> Result<()>

Source§

fn post_all_optimize( &mut self, module: &mut Module, ctx: &ComponentCtx, ) -> Result<bool>

Source§

impl<T: Debug + Any + Generator> Generator for [T]

Source§

fn pre_vfs(&mut self, module: &mut Module, ctx: &GeneratorCtx) -> Result<()>

Source§

fn pre_target( &mut self, module: &mut Module, ctx: &GeneratorCtx, external: &ModuleExternal, ) -> Result<()>

Source§

fn post_combine( &mut self, module: &mut Module, ctx: &GeneratorCtx, ) -> Result<()>

Source§

fn post_lower_memory( &mut self, module: &mut Module, ctx: &GeneratorCtx, ) -> Result<()>

Source§

fn post_components( &mut self, module: &mut Module, ctx: &ComponentCtx, ) -> Result<()>

Source§

fn post_all_optimize( &mut self, module: &mut Module, ctx: &ComponentCtx, ) -> Result<bool>

Implementors§