wasmtime_environ/component/
compiler.rs

1use crate::component::{ComponentTranslation, ComponentTypesBuilder};
2use crate::{Abi, CompiledFunctionBody, FuncKey, Tunables};
3use anyhow::Result;
4
5/// Compilation support necessary for components.
6pub trait ComponentCompiler: Send + Sync {
7    /// Compiles the pieces necessary to create a `VMFuncRef` for the
8    /// `trampoline` specified.
9    ///
10    /// Each trampoline is a member of the `Trampoline` enumeration and has a
11    /// unique purpose and is translated differently. See the implementation of
12    /// this trait for Cranelift for more information.
13    fn compile_trampoline(
14        &self,
15        component: &ComponentTranslation,
16        types: &ComponentTypesBuilder,
17        key: FuncKey,
18        abi: Abi,
19        tunables: &Tunables,
20        symbol: &str,
21    ) -> Result<CompiledFunctionBody>;
22}