pub trait CompilerBuilder: Send + Sync + Debug {
    // Required methods
    fn target(&mut self, target: Triple) -> Result<()>;
    fn triple(&self) -> &Triple;
    fn set(&mut self, name: &str, val: &str) -> Result<()>;
    fn enable(&mut self, name: &str) -> Result<()>;
    fn settings(&self) -> Vec<Setting>;
    fn enable_incremental_compilation(
        &mut self,
        cache_store: Arc<dyn CacheStore>
    );
    fn build(&self) -> Result<Box<dyn Compiler>>;
}
Expand description

Abstract trait representing the ability to create a Compiler below.

This is used in Wasmtime to separate compiler implementations, currently mostly used to separate Cranelift from Wasmtime itself.

Required Methods§

source

fn target(&mut self, target: Triple) -> Result<()>

Sets the target of compilation to the target specified.

source

fn triple(&self) -> &Triple

Returns the currently configured target triple that compilation will produce artifacts for.

source

fn set(&mut self, name: &str, val: &str) -> Result<()>

Compiler-specific method to configure various settings in the compiler itself.

This is expected to be defined per-compiler. Compilers should return errors for unknown names/values.

source

fn enable(&mut self, name: &str) -> Result<()>

Compiler-specific method for configuring settings.

Same as CompilerBuilder::set except for enabling boolean flags. Currently cranelift uses this to sometimes enable a family of settings.

source

fn settings(&self) -> Vec<Setting>

Returns a list of all possible settings that can be configured with CompilerBuilder::set and CompilerBuilder::enable.

source

fn enable_incremental_compilation(&mut self, cache_store: Arc<dyn CacheStore>)

Enables Cranelift’s incremental compilation cache, using the given CacheStore implementation.

source

fn build(&self) -> Result<Box<dyn Compiler>>

Builds a new Compiler object from this configuration.

Implementors§