(
&self,
env: &JNIEnv<'j>,
args: impl Iterator<Item = Val>,
wasm_alloc: Option<&WasmAlloc>,
store: impl AsContextMut,
)
| 94 | } |
| 95 | |
| 96 | pub(crate) unsafe fn load_from_args<'j>( |
| 97 | &self, |
| 98 | env: &JNIEnv<'j>, |
| 99 | args: impl Iterator<Item = Val>, |
| 100 | wasm_alloc: Option<&WasmAlloc>, |
| 101 | store: impl AsContextMut, |
| 102 | ) -> Result<JObject<'j>, anyhow::Error> { |
| 103 | match self { |
| 104 | WasmTy::ByteBuffer => { |
| 105 | // we do not want to deallocate here... |
| 106 | let wasm_slice = WasmSlice::load_from_args(args)?; |
| 107 | IntoByteBuffer(wasm_slice).into_java(env, wasm_alloc, store) |
| 108 | } |
| 109 | WasmTy::ByteArray => { |
| 110 | let wasm_slice = WasmSlice::load_from_args(args)?; |
| 111 | IntoByteArray(wasm_slice).into_java(env, wasm_alloc, store) |
| 112 | } |
| 113 | WasmTy::String => { |
| 114 | let wasm_slice = WasmSlice::load_from_args(args)?; |
| 115 | IntoString(wasm_slice).into_java(env, wasm_alloc, store) |
| 116 | } |
| 117 | WasmTy::ValType(ValType::I32) => { |
| 118 | i32::load_from_args(args)?.into_java(env, wasm_alloc, store) |
| 119 | } |
| 120 | WasmTy::ValType(ValType::I64) => { |
| 121 | i64::load_from_args(args)?.into_java(env, wasm_alloc, store) |
| 122 | } |
| 123 | WasmTy::ValType(ValType::F32) => { |
| 124 | f32::load_from_args(args)?.into_java(env, wasm_alloc, store) |
| 125 | } |
| 126 | WasmTy::ValType(ValType::F64) => { |
| 127 | f64::load_from_args(args)?.into_java(env, wasm_alloc, store) |
| 128 | } |
| 129 | WasmTy::ValType(_) => unimplemented!(), |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | pub(crate) fn return_or_push_arg_tys(&self, args: &mut Vec<ValType>) -> Option<ValType> { |
| 134 | match self { |
no test coverage detected