Rust, wasm, sharedarraybuffer, js

So I see funcs for creating, taking slice, and getting length of slice.

However:

  1. in Rust/wasm, how do we read/write the Vec<u8> the SharedArrayBuffer points to ?

  2. same question; in JS, how do we read/write the Vec<u8> the SharedArrayBuffer points to ?

According to a quick google search, you are supposed to pass the SharedArrayBuffer to the constructor of a typed array (e.g. Uint32Array) and then manipulate elements through the typed array's API.

In JS: Atomics - JavaScript | MDN
In Rust: I think you need to set up the Module with a shared array buffer as memory backing and then atomic operations might work...

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.