summaryrefslogtreecommitdiff
path: root/crates/types/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/types/src')
-rw-r--r--crates/types/src/lib.rs25
1 files changed, 24 insertions, 1 deletions
diff --git a/crates/types/src/lib.rs b/crates/types/src/lib.rs
index 2e76ac5..85bfcd2 100644
--- a/crates/types/src/lib.rs
+++ b/crates/types/src/lib.rs
@@ -67,7 +67,9 @@ pub struct TinyWasmModule {
/// Data segments of the WebAssembly module.
pub data: Box<[Data]>,
- // pub elements: Option<ElementSectionReader<'a>>,
+
+ /// Element segments of the WebAssembly module.
+ pub elements: Box<[Element]>,
}
/// A WebAssembly value.
@@ -366,3 +368,24 @@ pub enum DataKind {
Active { mem: MemAddr, offset: ConstInstruction },
Passive,
}
+
+#[derive(Debug, Clone)]
+pub struct Element {
+ pub kind: ElementKind,
+ pub items: Box<[ElementItem]>,
+ pub range: Range<usize>,
+ pub ty: ValType,
+}
+
+#[derive(Debug, Clone)]
+pub enum ElementKind {
+ Passive,
+ Active { table: TableAddr, offset: ConstInstruction },
+ Declared,
+}
+
+#[derive(Debug, Clone)]
+pub enum ElementItem {
+ Func(FuncAddr),
+ Expr(ConstInstruction),
+}