From a8269d7c0bf5e4c21d5d5dbb728e0ba4c63fa50e Mon Sep 17 00:00:00 2001 From: Henry Gressmann Date: Tue, 19 Dec 2023 17:42:00 +0100 Subject: feat: import section Signed-off-by: Henry Gressmann --- crates/types/src/lib.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'crates/types') diff --git a/crates/types/src/lib.rs b/crates/types/src/lib.rs index 387a878..a6cf037 100644 --- a/crates/types/src/lib.rs +++ b/crates/types/src/lib.rs @@ -28,7 +28,7 @@ extern crate alloc; mod instructions; use core::fmt::Debug; -use alloc::boxed::Box; +use alloc::{boxed::Box, string::String}; pub use instructions::*; /// A TinyWasm WebAssembly Module @@ -302,9 +302,14 @@ pub struct Export { #[derive(Debug, Clone)] pub struct Global { + pub ty: GlobalType, + pub init: ConstInstruction, +} + +#[derive(Debug, Clone)] +pub struct GlobalType { pub mutable: bool, pub ty: ValType, - pub init: ConstInstruction, } #[derive(Debug, Clone)] @@ -329,3 +334,19 @@ pub enum MemoryArch { I32, I64, } + +#[derive(Debug, Clone)] +pub struct Import { + /// Represents an import in a WebAssembly module. + pub module: String, + pub name: String, + pub kind: ImportKind, +} + +#[derive(Debug, Clone)] +pub enum ImportKind { + Func(TypeAddr), + Table(TableType), + Mem(MemoryType), + Global(GlobalType), +} -- cgit v1.3.1