substrate_wasmtime_runtime/
export.rs1use crate::vmcontext::{
2 VMContext, VMFunctionBody, VMGlobalDefinition, VMMemoryDefinition, VMSharedSignatureIndex,
3 VMTableDefinition,
4};
5use wasmtime_environ::wasm::Global;
6use wasmtime_environ::{MemoryPlan, TablePlan};
7
8#[derive(Debug, Clone)]
10pub enum Export {
11 Function(ExportFunction),
13
14 Table(ExportTable),
16
17 Memory(ExportMemory),
19
20 Global(ExportGlobal),
22}
23
24#[derive(Debug, Clone)]
26pub struct ExportFunction {
27 pub address: *const VMFunctionBody,
29 pub vmctx: *mut VMContext,
31 pub signature: VMSharedSignatureIndex,
35}
36
37impl From<ExportFunction> for Export {
38 fn from(func: ExportFunction) -> Export {
39 Export::Function(func)
40 }
41}
42
43#[derive(Debug, Clone)]
45pub struct ExportTable {
46 pub definition: *mut VMTableDefinition,
48 pub vmctx: *mut VMContext,
50 pub table: TablePlan,
52}
53
54impl From<ExportTable> for Export {
55 fn from(func: ExportTable) -> Export {
56 Export::Table(func)
57 }
58}
59
60#[derive(Debug, Clone)]
62pub struct ExportMemory {
63 pub definition: *mut VMMemoryDefinition,
65 pub vmctx: *mut VMContext,
67 pub memory: MemoryPlan,
69}
70
71impl From<ExportMemory> for Export {
72 fn from(func: ExportMemory) -> Export {
73 Export::Memory(func)
74 }
75}
76
77#[derive(Debug, Clone)]
79pub struct ExportGlobal {
80 pub definition: *mut VMGlobalDefinition,
82 pub vmctx: *mut VMContext,
84 pub global: Global,
86}
87
88impl From<ExportGlobal> for Export {
89 fn from(func: ExportGlobal) -> Export {
90 Export::Global(func)
91 }
92}