From 3b30f295f2991caad0759f6ee76c854264f921c8 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Mon, 8 Jun 2020 15:26:18 +0200 Subject: [PATCH] feat(depreacted) Port `Exports` and `Instance.exports`. --- lib/deprecated/runtime-core/src/instance.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/deprecated/runtime-core/src/instance.rs b/lib/deprecated/runtime-core/src/instance.rs index 701f8c91b..a942f1886 100644 --- a/lib/deprecated/runtime-core/src/instance.rs +++ b/lib/deprecated/runtime-core/src/instance.rs @@ -1,14 +1,20 @@ use crate::{module::Module, new, structures::TypedIndex, types::Value}; use std::{convert::Infallible, error::Error}; +pub use new::wasmer::Exports; + #[derive(Clone)] pub struct Instance { + pub exports: Exports, pub(crate) new_instance: new::wasmer::Instance, } impl Instance { pub(crate) fn new(new_instance: new::wasmer::Instance) -> Self { - Self { new_instance } + Self { + exports: new_instance.exports.clone(), + new_instance, + } } pub fn load(&self, _loader: T) -> Result { @@ -45,8 +51,8 @@ impl Instance { .into_vec()) } - pub fn exports(&self) -> &new::wasmer::Exports { - &self.new_instance.exports + pub fn exports(&self) -> Exports { + self.exports.clone() } pub fn module(&self) -> Module {