MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / with_runtime

Function with_runtime

compiler/src/main/mod.rs:107–109  ·  view source on GitHub ↗

SAFETY: single-threaded WASM; re-entrant callers route through `with_vm` to drop the borrow first.

(f: impl FnOnce(&mut WasmRuntime) -> R)

Source from the content-addressed store, hash-verified

105
106// SAFETY: single-threaded WASM; re-entrant callers route through `with_vm` to drop the borrow first.
107pub(super) fn with_runtime<R>(f: impl FnOnce(&mut WasmRuntime) -> R) -> R {
108 unsafe { f(&mut *core::ptr::addr_of_mut!(RUNTIME)) }
109}
110
111pub(super) fn put_val(v: Val) -> u32 { with_runtime(|rt| rt.handles.put(v.0)) }
112pub(super) fn get_val(h: u32) -> Option<Val> { with_runtime(|rt| rt.handles.get(h).map(Val)) }

Callers 15

stash_errorFunction · 0.85
panicFunction · 0.85
put_valFunction · 0.85
get_valFunction · 0.85
newMethod · 0.85
dropMethod · 0.85
with_vmFunction · 0.85
release_handlesFunction · 0.85
write_outFunction · 0.85
lookup_in_manifestMethod · 0.85
resolve_canonicalMethod · 0.85
src_ptrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected