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