From 4ee0bacbf79c41661b24e6cb9e4420cca33dc039 Mon Sep 17 00:00:00 2001 From: Henry Date: Sat, 23 Dec 2023 18:35:49 +0100 Subject: chore: parse element sections, improve contributing.md Signed-off-by: Henry --- crates/types/src/lib.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'crates/types/src') 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>, + + /// 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, + 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), +} -- cgit v1.3.1