Add constructor for ModuleRef

This commit is contained in:
Michael Mueller 2019-06-25 13:04:15 +02:00
parent f29f301e6e
commit 327d93c785
No known key found for this signature in database
GPG Key ID: 95756F716F423159
1 changed files with 7 additions and 0 deletions

View File

@ -37,6 +37,13 @@ use {Error, MemoryInstance, Module, RuntimeValue, Signature, TableInstance};
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct ModuleRef(pub(crate) Rc<ModuleInstance>); pub struct ModuleRef(pub(crate) Rc<ModuleInstance>);
impl ModuleRef {
/// Creates a new `ModuleRef` from a `ModuleInstance`.
pub fn new(instance: ModuleInstance) -> ModuleRef {
ModuleRef(Rc::new(instance))
}
}
impl ::core::ops::Deref for ModuleRef { impl ::core::ops::Deref for ModuleRef {
type Target = ModuleInstance; type Target = ModuleInstance;
fn deref(&self) -> &ModuleInstance { fn deref(&self) -> &ModuleInstance {