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

Function with_vm

compiler/src/main/mod.rs:132–136  ·  view source on GitHub ↗
(f: impl FnOnce(&mut VM<'static>) -> R)

Source from the content-addressed store, hash-verified

130}
131
132pub(super) fn with_vm<R>(f: impl FnOnce(&mut VM<'static>) -> R) -> Option<R> {
133 // Drop the runtime borrow before `f`, VM dispatch re-enters `with_runtime`.
134 let ptr = with_runtime(|rt| rt.current_vm)?;
135 Some(f(unsafe { &mut *ptr.as_ptr() }))
136}
137
138/* Builds a `&[u8]` from an FFI `(ptr, len)`, empty on null or zero length, `from_raw_parts` would UB on either. */
139pub(super) unsafe fn safe_bytes<'a>(ptr: *const u8, len: u32) -> &'a [u8] {

Callers 5

in_vmFunction · 0.85
with_recvFunction · 0.85
alloc_and_putFunction · 0.85
host_edge_decodeFunction · 0.85
make_native_bindingFunction · 0.85

Calls 1

with_runtimeFunction · 0.85

Tested by

no test coverage detected