diff --git a/lib/api/src/externals/function.rs b/lib/api/src/externals/function.rs index ce0dc51d2..4571542f6 100644 --- a/lib/api/src/externals/function.rs +++ b/lib/api/src/externals/function.rs @@ -40,10 +40,12 @@ pub enum FunctionDefinition { /// A WebAssembly `function` instance. /// /// A function instance is the runtime representation of a function. -/// It effectively is a closure of the original function over the runtime -/// `Instance` of its originating `Module`. The module instance is used -/// to resolve references to other definitions during execution of the -/// function. +/// It effectively is a closure of the original function (defined in either +/// the host or the WebAssembly module) over the runtime `Instance` of its +/// originating `Module`. +/// +/// The module instance is used to resolve references to other definitions +/// during execution of the function. /// /// Spec: https://webassembly.github.io/spec/core/exec/runtime.html#function-instances #[derive(Clone, PartialEq)] @@ -195,7 +197,7 @@ impl Function { } } - /// Returns the underlying [`FunctionType`] corresponding to this runtime `Function`. + /// Returns the [`FunctionType`] of the `Function`. pub fn ty(&self) -> &FunctionType { &self.exported.signature } diff --git a/lib/api/src/externals/global.rs b/lib/api/src/externals/global.rs index 30132aa39..86c33fbd4 100644 --- a/lib/api/src/externals/global.rs +++ b/lib/api/src/externals/global.rs @@ -60,7 +60,7 @@ impl Global { }) } - /// Returns the underlying [`GlobalType`] corresponding to this runtime `Global`. + /// Returns the [`GlobalType`] of the `Global`. pub fn ty(&self) -> &GlobalType { &self.exported.global } diff --git a/lib/api/src/externals/memory.rs b/lib/api/src/externals/memory.rs index 50006e4c4..e96bc5a59 100644 --- a/lib/api/src/externals/memory.rs +++ b/lib/api/src/externals/memory.rs @@ -10,7 +10,7 @@ use wasmer_vm::{Export, ExportMemory, Memory as RuntimeMemory, MemoryError}; /// A WebAssembly `memory` instance. /// /// A memory instance is the runtime representation of a linear memory. -/// It holds a vector of bytes and an optional maximum size. +/// It consists of a vector of bytes and an optional maximum size. /// /// The length of the vector always is a multiple of the WebAssembly /// page size, which is defined to be the constant 65536 – abbreviated 64Ki. @@ -42,7 +42,7 @@ impl Memory { }) } - /// Returns the underlying [`MemoryType`] corresponding to this runtime `Memory`. + /// Returns the [`MemoryType`] of the `Memory`. pub fn ty(&self) -> &MemoryType { self.memory.ty() } @@ -74,7 +74,7 @@ impl Memory { slice::from_raw_parts_mut(def.base, def.current_length) } - /// Returns the pointer to the `Memory`. + /// Returns the pointer to the raw bytes of the `Memory`. pub fn data_ptr(&self) -> *mut u8 { let definition = self.memory.vmmemory(); let def = unsafe { definition.as_ref() }; diff --git a/lib/api/src/externals/mod.rs b/lib/api/src/externals/mod.rs index 87759246a..1732854fe 100644 --- a/lib/api/src/externals/mod.rs +++ b/lib/api/src/externals/mod.rs @@ -15,19 +15,19 @@ use crate::store::{Store, StoreObject}; use crate::ExternType; use wasmer_vm::Export; -/// An external value is the runtime representation of an entity that +/// An `Extern` is the runtime representation of an entity that /// can be imported or exported. /// /// Spec: https://webassembly.github.io/spec/core/exec/runtime.html#external-values #[derive(Clone)] pub enum Extern { - /// A external [`Function`] + /// A external [`Function`]. Function(Function), - /// A external [`Global`] + /// A external [`Global`]. Global(Global), - /// A external [`Table`] + /// A external [`Table`]. Table(Table), - /// A external [`Memory`] + /// A external [`Memory`]. Memory(Memory), } diff --git a/lib/api/src/externals/table.rs b/lib/api/src/externals/table.rs index 353d72d5f..bd84a009b 100644 --- a/lib/api/src/externals/table.rs +++ b/lib/api/src/externals/table.rs @@ -55,7 +55,7 @@ impl Table { }) } - /// Gets the underlying [`TableType`]. + /// Returns the [`TableType`] of the `Table`. pub fn ty(&self) -> &TableType { self.table.ty() }