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§
Sourcefn pre_vfs(&mut self, module: &mut Module, ctx: &GeneratorCtx) -> Result<()>
fn pre_vfs(&mut self, module: &mut Module, ctx: &GeneratorCtx) -> Result<()>
Operations performed on the built VFS module.
Sourcefn pre_target(
&mut self,
module: &mut Module,
ctx: &GeneratorCtx,
external: &ModuleExternal,
) -> Result<()>
fn pre_target( &mut self, module: &mut Module, ctx: &GeneratorCtx, external: &ModuleExternal, ) -> Result<()>
Operations performed on the target module.
Sourcefn post_combine(
&mut self,
module: &mut Module,
ctx: &GeneratorCtx,
) -> Result<()>
fn post_combine( &mut self, module: &mut Module, ctx: &GeneratorCtx, ) -> Result<()>
Operations performed on the combined module.
Sourcefn post_lower_memory(
&mut self,
module: &mut Module,
ctx: &GeneratorCtx,
) -> Result<()>
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.
Sourcefn post_components(
&mut self,
module: &mut Module,
ctx: &ComponentCtx,
) -> Result<()>
fn post_components( &mut self, module: &mut Module, ctx: &ComponentCtx, ) -> Result<()>
Operations performed after components.
Sourcefn post_all_optimize(
&mut self,
module: &mut Module,
ctx: &ComponentCtx,
) -> Result<bool>
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)
impl<'a> Generator for &'a mut (dyn Generator + 'a)
Source§fn pre_vfs(&mut self, module: &mut Module, ctx: &GeneratorCtx) -> Result<()>
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<()>
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<()>
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<()>
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<()>
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>
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>
impl Generator for Box<dyn Generator + 'static>
Source§fn pre_vfs(&mut self, module: &mut Module, ctx: &GeneratorCtx) -> Result<()>
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<()>
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<()>
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<()>
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<()>
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>
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".