summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbbb651 🇮🇱 <53972231+bbb651@users.noreply.github.com>2025-07-17 22:44:05 +0300
committerGitHub <noreply@github.com>2025-07-17 21:44:05 +0200
commit749ebee2d588b9b5930d539995ff2473afc5cc4a (patch)
tree9143bd0a70989cb161b44d2e22f41d7da0bd9259 /crates
parentb7bc0c1a5ef814564d31cfbd54950144a7ced0f5 (diff)
fix: make `{ModuleInstance,FuncContext}::exported_memory` actually immutable (#41)
Diffstat (limited to 'crates')
-rw-r--r--crates/tinywasm/src/imports.rs4
-rw-r--r--crates/tinywasm/src/instance.rs4
2 files changed, 4 insertions, 4 deletions
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<MemoryRef<'_>> {
+ pub fn exported_memory(&self, name: &str) -> Result<MemoryRef<'_>> {
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<MemoryRefMut<'_>> {
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<MemoryRef<'a>> {
+ pub fn exported_memory<'a>(&self, store: &'a Store, name: &str) -> Result<MemoryRef<'a>> {
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<MemoryRefMut<'a>> {
let export = self.export_addr(name).ok_or_else(|| Error::Other(format!("Export not found: {name}")))?;
let ExternVal::Memory(mem_addr) = export else {