wasmer_types/compilation/
module.rs

1//! Types for modules.
2use crate::entity::PrimaryMap;
3use crate::{Features, MemoryIndex, MemoryStyle, ModuleInfo, TableIndex, TableStyle};
4use rkyv::{Archive, Deserialize as RkyvDeserialize, Serialize as RkyvSerialize};
5#[cfg(feature = "enable-serde")]
6use serde::{Deserialize, Serialize};
7use std::sync::Arc;
8
9/// The required info for compiling a module.
10///
11/// This differs from [`ModuleInfo`] because it have extra info only
12/// possible after translation (such as the features used for compiling,
13/// or the `MemoryStyle` and `TableStyle`).
14#[cfg_attr(feature = "enable-serde", derive(Deserialize, Serialize))]
15#[cfg_attr(feature = "artifact-size", derive(loupe::MemoryUsage))]
16#[derive(Debug, Clone, PartialEq, Eq, RkyvSerialize, RkyvDeserialize, Archive)]
17#[archive_attr(derive(rkyv::CheckBytes, Debug))]
18pub struct CompileModuleInfo {
19    /// The features used for compiling the module
20    pub features: Features,
21    /// The module information
22    pub module: Arc<ModuleInfo>,
23    /// The memory styles used for compiling.
24    ///
25    /// The compiler will emit the most optimal code based
26    /// on the memory style (static or dynamic) chosen.
27    pub memory_styles: PrimaryMap<MemoryIndex, MemoryStyle>,
28    /// The table plans used for compiling.
29    pub table_styles: PrimaryMap<TableIndex, TableStyle>,
30}