Skip to main content

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, StaticModuleIndex, WasmChecksum,
6    collections::TryPrimaryMap,
7    component::{Component, ComponentTypes, TypeComponentIndex},
8};
9use serde_derive::{Deserialize, Serialize};
10
11/// Serializable state that's stored in a compilation artifact.
12#[derive(Serialize, Deserialize)]
13pub struct ComponentArtifacts {
14    /// The type of this component.
15    pub ty: TypeComponentIndex,
16    /// Information all kept available at runtime as-is.
17    pub info: CompiledComponentInfo,
18    /// The index of every compiled function's location in the text section.
19    pub table: CompiledFunctionsTable,
20    /// Type information for this component and all contained modules.
21    pub types: ComponentTypes,
22    /// Serialized metadata about all included core wasm modules.
23    pub static_modules: TryPrimaryMap<StaticModuleIndex, CompiledModuleInfo>,
24    /// A checksum of the source Wasm binary from which the component was compiled.
25    pub checksum: WasmChecksum,
26}
27
28/// Runtime state that a component retains to support its operation.
29#[derive(Serialize, Deserialize)]
30pub struct CompiledComponentInfo {
31    /// Type information calculated during translation about this component.
32    pub component: Component,
33}