feat(deprecated) Port Instance::exports().

This commit is contained in:
Ivan Enderlin
2020-07-02 13:43:10 +02:00
parent 1a8c4669c2
commit d843dfc17d
2 changed files with 16 additions and 2 deletions

View File

@@ -10,5 +10,6 @@ impl Instance {
fn call(&self, name: &str, params: &[Value]) -> Result<Vec<Value>, Box<dyn Error>>; fn call(&self, name: &str, params: &[Value]) -> Result<Vec<Value>, Box<dyn Error>>;
fn context(&self) -> Ref<Ctx>; fn context(&self) -> Ref<Ctx>;
fn context_mut(&mut self) -> RefMut<Ctx>; fn context_mut(&mut self) -> RefMut<Ctx>;
fn exports(&self) -> ExportsIterator<impl Iterator<Item = (&String, &Export)>>;
fn module(&self) -> Module; fn module(&self) -> Module;
} }

View File

@@ -1,6 +1,13 @@
use crate::{ use crate::{
error::ExportError, export::Exportable, import::LikeNamespace, module::Module, new, error::ExportError,
structures::TypedIndex, typed_func::Func, types::Value, vm, export::{Export, Exportable},
import::LikeNamespace,
module::Module,
new,
structures::TypedIndex,
typed_func::Func,
types::Value,
vm,
}; };
use std::{ use std::{
cell::{Ref, RefCell, RefMut}, cell::{Ref, RefCell, RefMut},
@@ -107,6 +114,12 @@ impl Instance {
pub fn context_mut(&mut self) -> RefMut<vm::Ctx> { pub fn context_mut(&mut self) -> RefMut<vm::Ctx> {
self.pre_instance.vmctx.borrow_mut() self.pre_instance.vmctx.borrow_mut()
} }
pub fn exports(
&self,
) -> new::wasmer::ExportsIterator<impl Iterator<Item = (&String, &Export)>> {
self.new_instance.exports.iter()
}
} }
impl LikeNamespace for Instance { impl LikeNamespace for Instance {