MCPcopy Create free account
hub / github.com/explodingcamera/tinywasm / try_with_inner_mut

Method try_with_inner_mut

crates/tinywasm/src/store/memory/lazy.rs:53–60  ·  view source on GitHub ↗
(
        &self,
        f: impl FnOnce(&mut dyn LinearMemory) -> R,
    )

Source from the content-addressed store, hash-verified

51 }
52
53 fn try_with_inner_mut<R>(
54 &self,
55 f: impl FnOnce(&mut dyn LinearMemory) -> R,
56 ) -> core::result::Result<R, crate::Trap> {
57 self.try_ensure_materialized()?;
58 let mut inner = self.inner.borrow_mut();
59 Ok(f(inner.as_deref_mut().expect("lazy memory should be materialized")))
60 }
61
62 fn ensure_materialized(&self) {
63 if self.inner.borrow().is_some() {

Callers 6

grow_toMethod · 0.80
write_8Method · 0.80
write_16Method · 0.80
write_32Method · 0.80
write_64Method · 0.80
write_128Method · 0.80

Calls 1

Tested by

no test coverage detected