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