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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

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§

Source§

impl Generator for AdjustABI

Source§

impl Generator for ConnectWasip1ABI

Source§

impl Generator for ConnectWasip1ThreadsABI

Source§

impl Generator for NonRecursiveWasiABI

Source§

impl Generator for Anonymous

Source§

impl Generator for CheckUnusedThreads

Source§

impl Generator for CheckUseLibrary

Source§

impl Generator for CheckUseWasiVirtLayer

Source§

impl Generator for CheckVFSMemoryType

Source§

impl Generator for IsRustWasm

Source§

impl Generator for DebugCallFunctionMain

Source§

impl Generator for DebugCallFunctionSmallScale

Source§

impl Generator for DebugCallMemoryGrow

Source§

impl Generator for DebugExportVFSFunctions

Source§

impl Generator for SimpleDebug

Source§

impl Generator for MemoryBridge

Source§

impl Generator for MemoryTrap

Source§

impl Generator for TemporaryRefugeMemory

Source§

impl Generator for MultiMemoryLowering

Source§

impl Generator for PatchComponent

Source§

impl Generator for PollWait

Source§

impl Generator for Producer

Source§

impl Generator for SharedGlobal

Source§

impl Generator for MainVoidFunc

Source§

impl Generator for ResetFunc

Source§

impl Generator for StartFunc

Source§

impl Generator for FnInStartsGeneratorFirst

Source§

impl Generator for FnInStartsGeneratorLast

Source§

impl Generator for ComponentCtxVisitor

Source§

impl Generator for AtomicPatch

Source§

impl Generator for ThreadsSpawn

Source§

impl Generator for ThreadsSpawnPatch

Source§

impl Generator for ConnectVfsHost

Source§

impl Generator for WrapUnreachableGenerator

Source§

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