Hi! If I have a JS array and want to pass it to Rust/WASM and return it (modified), how do I do that? When using arrays I only get undefined. If it helps I can my code
Does that help?
hmm. Big thanks for your reply, @hellow! But I would like to avoid wasm-bindgen. I seem to me that FFI is more small scale, more ‘light-weight’ than wasm-bindgen. Do you by any chance have and good ideas? I think it should be possible when I read the documentation, just can’t figure out how…
Wasm-bindgen should be the lightest possible thing that works.
Ah, ok. Sorry! Did not know that. I thought that it was way larger… will look into that then! Hmm… perhaps I thought that, because you can (right?) generate stuff (elements and so on) directly into the browser. This lib is only for the ‘communication’ in-between, I think. I am a bit new to this. Really think it is very fun to play around with anyways!
nice! thank to you both for clearing this up for me!
@hellow Hello, This does help a bit. But in my case I want to return same Vec (with transformed values) from rust (wasm) to JS.
Please start a new thread, optionally linking to this one, instead of reviving a year old thread.
@alice Well, Not required.. I got the answer from https://rustwasm.github.io/docs/wasm-bindgen/reference/arbitrary-data-with-serde.html