Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make TypeArray deref into slices? #3805

Closed
DexterHill0 opened this issue Jan 21, 2024 · 0 comments
Closed

Make TypeArray deref into slices? #3805

DexterHill0 opened this issue Jan 21, 2024 · 0 comments
Labels

Comments

@DexterHill0
Copy link

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.

@rustwasm rustwasm locked and limited conversation to collaborators Jan 22, 2024
@daxpedda daxpedda converted this issue into discussion #3806 Jan 22, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

1 participant