Skip to content

Make TypeArray deref into slices? #3805

Closed
@DexterHill0

Description

@DexterHill0

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions