MCPcopy Create free account
hub / github.com/bluejekyll/wasmtime-java / as_mut

Method as_mut

wasmtime-jni/src/ty/wasm_alloc.rs:58–67  ·  view source on GitHub ↗
(
        &self,
        wasm_slice: WasmSlice,
        store: &'a mut impl AsContextMut,
    )

Source from the content-addressed store, hash-verified

56 /// Safety, the returned array is uninitialized
57 #[allow(clippy::mut_from_ref)]
58 pub unsafe fn as_mut<'a>(
59 &self,
60 wasm_slice: WasmSlice,
61 store: &'a mut impl AsContextMut,
62 ) -> &'a mut [u8] {
63 debug!("data ptr: {}", wasm_slice.ptr());
64
65 &mut self.memory.data_mut(store.as_context_mut())[wasm_slice.ptr() as usize..]
66 [..wasm_slice.len() as usize]
67 }
68
69 /// Allocates size bytes in the Wasm Memory context, returns the offset into the Memory region
70 pub unsafe fn alloc_size(

Callers 2

alloc_bytesMethod · 0.45
allocMethod · 0.45

Calls 2

ptrMethod · 0.80
lenMethod · 0.80

Tested by

no test coverage detected