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