Skip to main content

ComponentBuilder

Trait ComponentBuilder 

Source
pub trait ComponentBuilder: Send + Sync {
    // Required method
    fn build(&self, source_dir: &Path) -> Result<PathBuf, String>;
}
Expand description

Produces a .wasm component from a source directory.

A trait rather than a free function so the staleness, caching and failure logic below can be tested without a wasm32-wasip2 toolchain — those are the parts with the interesting behaviour, and they should not be untestable on a machine that cannot compile a component.

Required Methods§

Source

fn build(&self, source_dir: &Path) -> Result<PathBuf, String>

Build source_dir; return the path of the produced component.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§