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

@@ -15,15 +15,24 @@ use crate::store::{Store, StoreObject};
use crate::ExternType;
use wasmer_vm::Export;
/// An external value 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`]
Function(Function),
/// A external [`Global`]
Global(Global),
/// A external [`Table`]
Table(Table),
/// A external [`Memory`]
Memory(Memory),
}
impl Extern {
/// Return the undelying type of the inner `Extern`.
pub fn ty(&self) -> ExternType {
match self {
Extern::Function(ft) => ExternType::Function(ft.ty().clone()),