I want to create a function find
which accepts a matrix
argument with type Vec<Vec<isize>>
and returns another matrix with type Vec<Vec<(usize, usize)>>
. Unfortunately, wasm_bindgen
complains that types are not "compatible".
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
^^^^^^^^^^^^ <- Error
pub fn find (matrix: Vec<Vec<isize>>, threshold: usize) -> Vec<Vec<(usize, usize)>> {
// cut
}
Error
rustc: the trait bound `Vec<isize>: JsObject` is not satisfied
the following other types implement trait `JsObject`:
Array
ArrayBuffer
BigInt
BigInt64Array
BigUint64Array
Boolean
Collator
CompileError
and 47 others
required because of the requirements on the impl of `FromWasmAbi` for `Box<[Vec<isize>]>`
3. rustc: the trait bound `Vec<(usize, usize)>: JsObject` is not satisfied
the following other types implement trait `JsObject`:
Array
ArrayBuffer
BigInt
BigInt64Array
BigUint64Array
Boolean
Collator
CompileError
and 47 others
required because of the requirements on the impl of `IntoWasmAbi` for `Box<[Vec<(usize, usize)>]>`
What function signature to use in this case?