summaryrefslogtreecommitdiff
path: root/crates/types/src
diff options
context:
space:
mode:
authorHenry Gressmann <mail@henrygressmann.de>2023-12-19 17:42:00 +0100
committerHenry Gressmann <mail@henrygressmann.de>2023-12-19 17:42:00 +0100
commita8269d7c0bf5e4c21d5d5dbb728e0ba4c63fa50e (patch)
treec4d176e65d756ab2e0ec527a2ed82308133e69fd /crates/types/src
parent45b11e3260c10afa45338525413f609100b76940 (diff)
feat: import section
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'crates/types/src')
-rw-r--r--crates/types/src/lib.rs25
1 files changed, 23 insertions, 2 deletions
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),
+}