lucet_module/
module.rs

1use crate::functions::FunctionSpec;
2use crate::module_data::ModuleData;
3use crate::tables::TableElement;
4use crate::version_info::VersionInfo;
5
6pub const LUCET_MODULE_SYM: &str = "lucet_module";
7
8/// Module is the exposed structure that contains all the data backing a Lucet-compiled object.
9#[derive(Debug)]
10pub struct Module<'a> {
11    pub version: VersionInfo,
12    pub module_data: ModuleData<'a>,
13    pub tables: &'a [&'a [TableElement]],
14    pub function_manifest: &'a [FunctionSpec],
15}
16
17/// SerializedModule is a serialization-friendly form of Module, in that the `module_data_*` fields
18/// here refer to a serialized `ModuleData`, while `tables_*` and `function_manifest_*` refer to
19/// the actual tables and function manifest written in the binary.
20#[repr(C)]
21#[derive(Debug)]
22pub struct SerializedModule {
23    pub version: VersionInfo,
24    pub module_data_ptr: u64,
25    pub module_data_len: u64,
26    pub tables_ptr: u64,
27    pub tables_len: u64,
28    pub function_manifest_ptr: u64,
29    pub function_manifest_len: u64,
30}