summaryrefslogtreecommitdiff
path: root/crates/types/src
diff options
context:
space:
mode:
authorHenry Gressmann <mail@henrygressmann.de>2023-12-09 14:56:03 +0100
committerHenry Gressmann <mail@henrygressmann.de>2023-12-09 14:56:03 +0100
commitd08750034a582b7ef338432a360c62a2969f6aa0 (patch)
tree577296351a97ed044dd2ceabc7d772c42cf21c0f /crates/types/src
parentea0a362c585c2a2da39ec8fbafacd79c17680665 (diff)
chore: improve documentation
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'crates/types/src')
-rw-r--r--crates/types/src/instructions.rs12
-rw-r--r--crates/types/src/lib.rs19
2 files changed, 20 insertions, 11 deletions
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]>,