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 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
}

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 {
&self.exported.global
}

View File

@@ -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() };

View File

@@ -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),
}

View File

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