diff options
Diffstat (limited to 'crates/types')
| -rw-r--r-- | crates/types/Cargo.toml | 3 | ||||
| -rw-r--r-- | crates/types/README.md | 1 | ||||
| -rw-r--r-- | crates/types/src/instructions.rs | 12 | ||||
| -rw-r--r-- | crates/types/src/lib.rs | 19 |
4 files changed, 23 insertions, 12 deletions
diff --git a/crates/types/Cargo.toml b/crates/types/Cargo.toml index 082723f..e91a4f1 100644 --- a/crates/types/Cargo.toml +++ b/crates/types/Cargo.toml @@ -1,7 +1,8 @@ [package] name="tinywasm-types" -version="0.0.0" +version="0.0.1" edition="2021" +readme="../../README.md" [dependencies] log={version="0.4", optional=true} diff --git a/crates/types/README.md b/crates/types/README.md new file mode 100644 index 0000000..93b6f4b --- /dev/null +++ b/crates/types/README.md @@ -0,0 +1 @@ +# `tinywasm_types` diff --git a/crates/types/src/instructions.rs b/crates/types/src/instructions.rs index 005da36..6db5e6b 100644 --- a/crates/types/src/instructions.rs +++ b/crates/types/src/instructions.rs @@ -18,17 +18,19 @@ type BrTableDefault = u32; type BrTableLen = usize; /// A WebAssembly Instruction -/// See https://webassembly.github.io/spec/core/binary/instructions.html +/// /// These are our own internal bytecode instructions so they may not match the spec exactly. /// Wasm Bytecode can map to multiple of these instructions. /// For example, `br_table` stores the jump lables in the following `br_label` instructions to keep this enum small. +/// +/// See <https://webassembly.github.io/spec/core/binary/instructions.html> #[derive(Debug, Clone, Copy, PartialEq)] pub enum Instruction { // Custom Instructions BrLabel(LabelAddr), // Control Instructions - // See https://webassembly.github.io/spec/core/binary/instructions.html#control-instructions + // See <https://webassembly.github.io/spec/core/binary/instructions.html#control-instructions> Unreachable, Nop, Block(BlockArgs), @@ -44,12 +46,12 @@ pub enum Instruction { CallIndirect(TypeAddr, TableAddr), // Parametric Instructions - // See https://webassembly.github.io/spec/core/binary/instructions.html#parametric-instructions + // See <https://webassembly.github.io/spec/core/binary/instructions.html#parametric-instructions> Drop, Select, // Variable Instructions - // See https://webassembly.github.io/spec/core/binary/instructions.html#variable-instructions + // See <https://webassembly.github.io/spec/core/binary/instructions.html#variable-instructions> LocalGet(LocalAddr), LocalSet(LocalAddr), LocalTee(LocalAddr), @@ -90,7 +92,7 @@ pub enum Instruction { F64Const(f64), // Numeric Instructions - // See https://webassembly.github.io/spec/core/binary/instructions.html#numeric-instructions + // See <https://webassembly.github.io/spec/core/binary/instructions.html#numeric-instructions> I32Eqz, I32Eq, I32Ne, diff --git a/crates/types/src/lib.rs b/crates/types/src/lib.rs index 90c4f10..b79c72a 100644 --- a/crates/types/src/lib.rs +++ b/crates/types/src/lib.rs @@ -34,7 +34,8 @@ pub struct TinyWasmModule { } /// A WebAssembly value. -/// See https://webassembly.github.io/spec/core/syntax/types.html#value-types +/// +/// See <https://webassembly.github.io/spec/core/syntax/types.html#value-types> #[derive(Clone, PartialEq, Copy)] pub enum WasmValue { // Num types @@ -182,7 +183,8 @@ pub enum ValType { } /// A WebAssembly External Kind. -/// See https://webassembly.github.io/spec/core/syntax/types.html#external-types +/// +/// See <https://webassembly.github.io/spec/core/syntax/types.html#external-types> #[derive(Debug, Clone, PartialEq)] pub enum ExternalKind { Func, @@ -192,8 +194,10 @@ pub enum ExternalKind { } /// A WebAssembly Address. +/// /// These are indexes into the respective stores. -/// See https://webassembly.github.io/spec/core/exec/runtime.html#addresses +/// +/// See <https://webassembly.github.io/spec/core/exec/runtime.html#addresses> pub type Addr = u32; pub type FuncAddr = Addr; pub type TableAddr = Addr; @@ -209,7 +213,8 @@ pub type LabelAddr = Addr; pub type ModuleInstanceAddr = Addr; /// A WebAssembly Export Instance. -/// https://webassembly.github.io/spec/core/exec/runtime.html#export-instances +/// +/// See <https://webassembly.github.io/spec/core/exec/runtime.html#export-instances> #[derive(Debug)] pub struct ExportInst { pub name: String, @@ -217,7 +222,8 @@ pub struct ExportInst { } /// A WebAssembly External Value. -/// https://webassembly.github.io/spec/core/exec/runtime.html#external-values +/// +/// See <https://webassembly.github.io/spec/core/exec/runtime.html#external-values> #[derive(Debug)] pub enum ExternVal { Func(FuncAddr), @@ -227,7 +233,8 @@ pub enum ExternVal { } /// The type of a WebAssembly Function. -/// See https://webassembly.github.io/spec/core/syntax/types.html#function-types +/// +/// See <https://webassembly.github.io/spec/core/syntax/types.html#function-types> #[derive(Debug, Clone, PartialEq)] pub struct FuncType { pub params: Box<[ValType]>, |
