Expose Module reference from InstanceHandle

This commit is contained in:
Yury Delendik
2019-05-14 16:00:35 -05:00
committed by Dan Gohman
parent 2b5be77fa5
commit 6740704b74

View File

@@ -784,6 +784,16 @@ impl InstanceHandle {
self.instance().vmctx_ptr() self.instance().vmctx_ptr()
} }
/// Return a reference-counting pointer to a module.
pub fn module(&self) -> Rc<Module> {
self.instance().module.clone()
}
/// Return a reference to a module.
pub fn module_ref(&self) -> &Module {
&self.instance().module
}
/// Return a mutable reference to the vmctx used by compiled wasm code. /// Return a mutable reference to the vmctx used by compiled wasm code.
pub fn vmctx_mut(&mut self) -> &mut VMContext { pub fn vmctx_mut(&mut self) -> &mut VMContext {
self.instance_mut().vmctx_mut() self.instance_mut().vmctx_mut()