diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2023-12-19 14:37:51 +0100 |
|---|---|---|
| committer | Henry Gressmann <mail@henrygressmann.de> | 2023-12-19 14:37:51 +0100 |
| commit | 375f9aa32b117a42c7a9c7f29d3c592b81d966be (patch) | |
| tree | 4673abc196c01435578d6594c30e5987298dd325 /crates/types | |
| parent | 820ecb429f57053098684e209b8a3a00cb0ac973 (diff) | |
feat: parse memory and table sections
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'crates/types')
| -rw-r--r-- | crates/types/src/lib.rs | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/crates/types/src/lib.rs b/crates/types/src/lib.rs index ddc8ce4..387a878 100644 --- a/crates/types/src/lib.rs +++ b/crates/types/src/lib.rs @@ -48,13 +48,19 @@ pub struct TinyWasmModule { pub funcs: Box<[Function]>, /// The types of the WebAssembly module. - pub types: Box<[FuncType]>, + pub func_types: Box<[FuncType]>, /// The exports of the WebAssembly module. pub exports: Box<[Export]>, + + /// The tables of the WebAssembly module. pub globals: Box<[Global]>, - // pub tables: Option<TableType>, - // pub memories: Option<MemoryType>, + + /// The tables of the WebAssembly module. + pub table_types: Box<[TableType]>, + + /// The memories of the WebAssembly module. + pub memory_types: Box<[MemoryType]>, // pub elements: Option<ElementSectionReader<'a>>, // pub imports: Option<ImportSectionReader<'a>>, // pub data_segments: Option<DataSectionReader<'a>>, @@ -300,3 +306,26 @@ pub struct Global { pub ty: ValType, pub init: ConstInstruction, } + +#[derive(Debug, Clone)] +pub struct TableType { + pub element_type: ValType, + pub size_initial: u32, + pub size_max: Option<u32>, +} + +#[derive(Debug, Clone)] + +/// Represents a memory's type. +#[derive(Copy, PartialEq, Eq, Hash)] +pub struct MemoryType { + pub arch: MemoryArch, + pub page_count_initial: u64, + pub page_count_max: Option<u64>, +} + +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] +pub enum MemoryArch { + I32, + I64, +} |
