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

Method obj_as_mut

wasmtime-jni/src/ty/wasm_alloc.rs:159–165  ·  view source on GitHub ↗
(&self, ptr: i32, store: S)

Source from the content-addressed store, hash-verified

157
158 #[allow(clippy::mut_from_ref)]
159 pub unsafe fn obj_as_mut<T: Sized, S: AsContextMut>(&self, ptr: i32, store: S) -> &mut T {
160 debug_assert!(ptr > 0);
161 let ptr_to_mem = self.memory.data_ptr(store).add(ptr as usize);
162 debug!("dereffing {:x?} from offset {:x?}", ptr_to_mem, ptr);
163
164 &mut *(ptr_to_mem as *mut T)
165 }
166
167 #[allow(unused)]
168 pub unsafe fn dealloc<T: Sized>(

Callers 1

Calls 1

ptrMethod · 0.80

Tested by

no test coverage detected