wasmtime_environ/component/
artifacts.rs

1//! Definitions of compilation artifacts of the component compilation process
2//! which are serialized with `bincode` into output ELF files.
3
4use crate::{
5    CompiledFunctionsTable, CompiledModuleInfo, PrimaryMap, StaticModuleIndex,
6    component::{Component, ComponentTypes, TypeComponentIndex},
7};
8use serde_derive::{Deserialize, Serialize};
9
10/// Serializable state that's stored in a compilation artifact.
11#[derive(Serialize, Deserialize)]
12pub struct ComponentArtifacts {
13    /// The type of this component.
14    pub ty: TypeComponentIndex,
15    /// Information all kept available at runtime as-is.
16    pub info: CompiledComponentInfo,
17    /// The index of every compiled function's location in the text section.
18    pub table: CompiledFunctionsTable,
19    /// Type information for this component and all contained modules.
20    pub types: ComponentTypes,
21    /// Serialized metadata about all included core wasm modules.
22    pub static_modules: PrimaryMap<StaticModuleIndex, CompiledModuleInfo>,
23}
24
25/// Runtime state that a component retains to support its operation.
26#[derive(Serialize, Deserialize)]
27pub struct CompiledComponentInfo {
28    /// Type information calculated during translation about this component.
29    pub component: Component,
30}