(f: impl FnOnce(&mut VM<'static>) -> R)
| 130 | } |
| 131 | |
| 132 | pub(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. */ |
| 139 | pub(super) unsafe fn safe_bytes<'a>(ptr: *const u8, len: u32) -> &'a [u8] { |
no test coverage detected