Added spec docs to app API public objects

This commit is contained in:
Syrus
2020-07-15 17:39:50 -07:00
parent 69abe305ab
commit 7bf6b9efc9
11 changed files with 121 additions and 17 deletions

View File

@@ -12,6 +12,8 @@ use wasmer_vm::{Export, ExportTable, Table as RuntimeTable, VMCallerCheckedAnyfu
///
/// A table created by the host or in WebAssembly code will be accessible and
/// mutable from both host and WebAssembly.
///
/// Spec: https://webassembly.github.io/spec/core/exec/runtime.html#table-instances
#[derive(Clone)]
pub struct Table {
store: Store,
@@ -30,6 +32,8 @@ impl Table {
/// Creates a new `Table` with the provided [`TableType`] definition.
///
/// All the elements in the table will be set to the `init` value.
///
/// This function will construct the `Table` using the store [`Tunables`].
pub fn new(store: &Store, ty: TableType, init: Val) -> Result<Table, RuntimeError> {
let item = init.into_checked_anyfunc(store)?;
let tunables = store.tunables();
@@ -54,6 +58,7 @@ impl Table {
self.table.ty()
}
/// Returns the [`Store`] that owns this `Table`.
pub fn store(&self) -> &Store {
&self.store
}