(
self,
env: &JNIEnv<'j>,
wasm_alloc: Option<&WasmAlloc>,
mut store: S,
)
| 324 | struct IntoByteBuffer(WasmSlice); |
| 325 | impl IntoJavaObject for IntoByteBuffer { |
| 326 | unsafe fn into_java<'j, S: AsContextMut>( |
| 327 | self, |
| 328 | env: &JNIEnv<'j>, |
| 329 | wasm_alloc: Option<&WasmAlloc>, |
| 330 | mut store: S, |
| 331 | ) -> Result<JObject<'j>, Error> { |
| 332 | let wasm_alloc = |
| 333 | wasm_alloc.ok_or_else(|| anyhow!("WasmAlloc is required for this return type"))?; |
| 334 | let bytes = wasm_alloc.as_mut(self.0, &mut store); |
| 335 | |
| 336 | debug!( |
| 337 | "length of bytes for ByteBuffer: {} expected len: {}", |
| 338 | bytes.len(), |
| 339 | self.0.len() |
| 340 | ); |
| 341 | debug!("read bytes from wasm_slice: {:x?}", bytes); |
| 342 | |
| 343 | let buffer = env |
| 344 | .new_direct_byte_buffer(bytes) |
| 345 | .context("Failed to create new ByteBuffer")?; |
| 346 | |
| 347 | Ok(buffer.into()) |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | struct IntoByteArray(WasmSlice); |
no test coverage detected