mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-09 22:28:21 +00:00
Improved docs a bit further
This commit is contained in:
12
lib/api/src/externals/function.rs
vendored
12
lib/api/src/externals/function.rs
vendored
@@ -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
|
||||
}
|
||||
|
||||
2
lib/api/src/externals/global.rs
vendored
2
lib/api/src/externals/global.rs
vendored
@@ -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
|
||||
}
|
||||
|
||||
6
lib/api/src/externals/memory.rs
vendored
6
lib/api/src/externals/memory.rs
vendored
@@ -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() };
|
||||
|
||||
10
lib/api/src/externals/mod.rs
vendored
10
lib/api/src/externals/mod.rs
vendored
@@ -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),
|
||||
}
|
||||
|
||||
|
||||
2
lib/api/src/externals/table.rs
vendored
2
lib/api/src/externals/table.rs
vendored
@@ -55,7 +55,7 @@ impl Table {
|
||||
})
|
||||
}
|
||||
|
||||
/// Gets the underlying [`TableType`].
|
||||
/// Returns the [`TableType`] of the `Table`.
|
||||
pub fn ty(&self) -> &TableType {
|
||||
self.table.ty()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user