1 //! Definitions of compilation artifacts of the component compilation process
2 //! which are serialized with `bincode` into output ELF files.
3 
4 use crate::{
5     CompiledFunctionsTable, CompiledModuleInfo, PrimaryMap, StaticModuleIndex, WasmChecksum,
6     component::{Component, ComponentTypes, TypeComponentIndex},
7 };
8 use serde_derive::{Deserialize, Serialize};
9 
10 /// Serializable state that's stored in a compilation artifact.
11 #[derive(Serialize, Deserialize)]
12 pub 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     /// A checksum of the source Wasm binary from which the component was compiled.
24     pub checksum: WasmChecksum,
25 }
26 
27 /// Runtime state that a component retains to support its operation.
28 #[derive(Serialize, Deserialize)]
29 pub struct CompiledComponentInfo {
30     /// Type information calculated during translation about this component.
31     pub component: Component,
32 }
33