I'm writing Rust code which right now accepts two files as Vec<u8>
. I want to make it accept an arbitrary number of files, but using something like Vec<&[u8]>
returns
the trait `JsObject` is not implemented for `&[u8]`
For Vec<Vec<u8>>
I get a similar message:
the trait `JsObject` is not implemented for `Vec<u8>`
Is there any way I can make it work?
I saw this pull request and the assocated issues https://github.com/rustwasm/wasm-bindgen/pull/2614, however this doesn't help me understand how I could achieve this. Maybe I should try something like Vec<Uint8Array>
instead? But then wasm-bindgen would first copy each Uint8Array
into the Wasm memory and then I'd need to copy Uint8Array
into a new Vec
just so that I can read that data in Rust.
I'm using wasm-bindgen 0.2.75 and Rust 1.54.