(
&self,
store: &mut Store<JavaState>,
)
| 137 | } |
| 138 | |
| 139 | pub fn alloc<T: Sized>( |
| 140 | &self, |
| 141 | store: &mut Store<JavaState>, |
| 142 | ) -> Result<WasmSliceWrapper<'_>, Error> { |
| 143 | let wasm_slice = unsafe { self.alloc_size(mem::size_of::<T>(), &mut *store)? }; |
| 144 | |
| 145 | // zero out the memory... |
| 146 | for b in unsafe { wasm_slice.as_mut(&mut *store) } { |
| 147 | *b = 0; |
| 148 | } |
| 149 | |
| 150 | debug!( |
| 151 | "stored {} at {:x?}", |
| 152 | std::any::type_name::<T>(), |
| 153 | wasm_slice.wasm_slice().ptr() |
| 154 | ); |
| 155 | Ok(wasm_slice) |
| 156 | } |
| 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 { |
nothing calls this directly
no test coverage detected