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

Method try_ensure_materialized

crates/tinywasm/src/store/memory/lazy.rs:71–86  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

69 }
70
71 fn try_ensure_materialized(&self) -> core::result::Result<(), crate::Trap> {
72 if self.inner.borrow().is_some() {
73 return Ok(());
74 }
75
76 let storage = match self.backend.create(self.ty, self.initial_len) {
77 Ok(storage) => storage,
78 Err(Error::Trap(trap)) => {
79 cold_path();
80 return Err(trap);
81 }
82 Err(err) => panic!("lazy memory materialization failed: {err}"),
83 };
84 *self.inner.borrow_mut() = Some(storage.0);
85 Ok(())
86 }
87}
88
89impl LinearMemory for LazyLinearMemory {

Callers 2

try_with_innerMethod · 0.80
try_with_inner_mutMethod · 0.80

Calls 1

createMethod · 0.80

Tested by

no test coverage detected