Improved docs a bit further

This commit is contained in:
Syrus
2020-07-15 18:12:18 -07:00
parent 0c13173624
commit 9a80977743
5 changed files with 17 additions and 15 deletions

View File

@@ -40,10 +40,12 @@ pub enum FunctionDefinition {
/// A WebAssembly `function` instance. /// A WebAssembly `function` instance.
/// ///
/// A function instance is the runtime representation of a function. /// A function instance is the runtime representation of a function.
/// It effectively is a closure of the original function over the runtime /// It effectively is a closure of the original function (defined in either
/// `Instance` of its originating `Module`. The module instance is used /// the host or the WebAssembly module) over the runtime `Instance` of its
/// to resolve references to other definitions during execution of the /// originating `Module`.
/// function. ///
/// 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 /// Spec: https://webassembly.github.io/spec/core/exec/runtime.html#function-instances
#[derive(Clone, PartialEq)] #[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 { pub fn ty(&self) -> &FunctionType {
&self.exported.signature &self.exported.signature
} }

View File

@@ -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 { pub fn ty(&self) -> &GlobalType {
&self.exported.global &self.exported.global
} }

View File

@@ -10,7 +10,7 @@ use wasmer_vm::{Export, ExportMemory, Memory as RuntimeMemory, MemoryError};
/// A WebAssembly `memory` instance. /// A WebAssembly `memory` instance.
/// ///
/// A memory instance is the runtime representation of a linear memory. /// 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 /// The length of the vector always is a multiple of the WebAssembly
/// page size, which is defined to be the constant 65536 abbreviated 64Ki. /// 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 { pub fn ty(&self) -> &MemoryType {
self.memory.ty() self.memory.ty()
} }
@@ -74,7 +74,7 @@ impl Memory {
slice::from_raw_parts_mut(def.base, def.current_length) 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 { pub fn data_ptr(&self) -> *mut u8 {
let definition = self.memory.vmmemory(); let definition = self.memory.vmmemory();
let def = unsafe { definition.as_ref() }; let def = unsafe { definition.as_ref() };

View File

@@ -15,19 +15,19 @@ use crate::store::{Store, StoreObject};
use crate::ExternType; use crate::ExternType;
use wasmer_vm::Export; 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. /// can be imported or exported.
/// ///
/// Spec: https://webassembly.github.io/spec/core/exec/runtime.html#external-values /// Spec: https://webassembly.github.io/spec/core/exec/runtime.html#external-values
#[derive(Clone)] #[derive(Clone)]
pub enum Extern { pub enum Extern {
/// A external [`Function`] /// A external [`Function`].
Function(Function), Function(Function),
/// A external [`Global`] /// A external [`Global`].
Global(Global), Global(Global),
/// A external [`Table`] /// A external [`Table`].
Table(Table), Table(Table),
/// A external [`Memory`] /// A external [`Memory`].
Memory(Memory), Memory(Memory),
} }

View File

@@ -55,7 +55,7 @@ impl Table {
}) })
} }
/// Gets the underlying [`TableType`]. /// Returns the [`TableType`] of the `Table`.
pub fn ty(&self) -> &TableType { pub fn ty(&self) -> &TableType {
self.table.ty() self.table.ty()
} }