Add constructor for ModuleRef
This commit is contained in:
parent
f29f301e6e
commit
327d93c785
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue