From d843dfc17d536fbb3d1bcd8331dae43fe59aaa7c Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Thu, 2 Jul 2020 13:43:10 +0200 Subject: [PATCH] feat(deprecated) Port `Instance::exports()`. --- .../runtime-core/doc/new-api/instance.rs | 1 + lib/deprecated/runtime-core/src/instance.rs | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/deprecated/runtime-core/doc/new-api/instance.rs b/lib/deprecated/runtime-core/doc/new-api/instance.rs index 4f1e25142..4623ffa7c 100644 --- a/lib/deprecated/runtime-core/doc/new-api/instance.rs +++ b/lib/deprecated/runtime-core/doc/new-api/instance.rs @@ -10,5 +10,6 @@ impl Instance { fn call(&self, name: &str, params: &[Value]) -> Result, Box>; fn context(&self) -> Ref; fn context_mut(&mut self) -> RefMut; + fn exports(&self) -> ExportsIterator>; fn module(&self) -> Module; } diff --git a/lib/deprecated/runtime-core/src/instance.rs b/lib/deprecated/runtime-core/src/instance.rs index faa68c076..fd583a813 100644 --- a/lib/deprecated/runtime-core/src/instance.rs +++ b/lib/deprecated/runtime-core/src/instance.rs @@ -1,6 +1,13 @@ use crate::{ - error::ExportError, export::Exportable, import::LikeNamespace, module::Module, new, - structures::TypedIndex, typed_func::Func, types::Value, vm, + error::ExportError, + export::{Export, Exportable}, + import::LikeNamespace, + module::Module, + new, + structures::TypedIndex, + typed_func::Func, + types::Value, + vm, }; use std::{ cell::{Ref, RefCell, RefMut}, @@ -107,6 +114,12 @@ impl Instance { pub fn context_mut(&mut self) -> RefMut { self.pre_instance.vmctx.borrow_mut() } + + pub fn exports( + &self, + ) -> new::wasmer::ExportsIterator> { + self.new_instance.exports.iter() + } } impl LikeNamespace for Instance {