wasmer_compiler/types/
module.rs

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