Make TypeArray deref into slices?
DexterHill0 opened this issue · comments
Summary
Maybe I'm missing something, but is there any way to take a typed array (say, UInt8Array) and turn it into a &[u8]
, or the equivalent? I found issue #5 but that was a very long time ago and I'm not sure if its still applicable.
In my use case I load a large image as an ArrayBuffer
from an HTTP request, convert it into a UInt8Array
and pass that to the WASM. Inside the WASM is a function that takes a &[u8]
and it would be convinient, and more efficient, to be able to take a reference to the UInt8Array
rather than first allocate an enourmous vector, then take a slice of that.