diff --git a/crates/tinywasm/src/imports.rs b/crates/tinywasm/src/imports.rs index 90f4971..563e586 100644 --- a/crates/tinywasm/src/imports.rs +++ b/crates/tinywasm/src/imports.rs @@ -72,11 +72,11 @@ impl FuncContext<'_> { } /// Get a reference to an exported memory - pub fn exported_memory(&mut self, name: &str) -> Result> { + pub fn exported_memory(&self, name: &str) -> Result> { self.module().exported_memory(self.store, name) } - /// Get a reference to an exported memory + /// Get a mutable reference to an exported memory pub fn exported_memory_mut(&mut self, name: &str) -> Result> { self.module().exported_memory_mut(self.store, name) } diff --git a/crates/tinywasm/src/instance.rs b/crates/tinywasm/src/instance.rs index 75c12d6..aaa3407 100644 --- a/crates/tinywasm/src/instance.rs +++ b/crates/tinywasm/src/instance.rs @@ -189,7 +189,7 @@ impl ModuleInstance { } /// Get an exported memory by name - pub fn exported_memory<'a>(&self, store: &'a mut Store, name: &str) -> Result> { + pub fn exported_memory<'a>(&self, store: &'a Store, name: &str) -> Result> { let export = self.export_addr(name).ok_or_else(|| Error::Other(format!("Export not found: {name}")))?; let ExternVal::Memory(mem_addr) = export else { return Err(Error::Other(format!("Export is not a memory: {name}"))); @@ -198,7 +198,7 @@ impl ModuleInstance { self.memory(store, mem_addr) } - /// Get an exported memory by name + /// Get an exported memory by name (mutable) pub fn exported_memory_mut<'a>(&self, store: &'a mut Store, name: &str) -> Result> { let export = self.export_addr(name).ok_or_else(|| Error::Other(format!("Export not found: {name}")))?; let ExternVal::Memory(mem_addr) = export else {