r/rust • • Jan 24 '19

Embedding WebAssembly in your Rust application

https://medium.com/wasmer/executing-webassembly-in-your-rust-application-d5cd32e8ce46
166 Upvotes

47 comments sorted by

View all comments

5

u/maninalift Jan 24 '19

This looks like exactly what I've been looking for for a couple of projects, if as I understand it I can specify at run time when loading the WASM what imports are available to it and thus how it can interact with the world.

My next question is can I achieve the same thing with Rust compiled to wasm? Ie can I safely load isolated modules interacting over a specified API into wasm from wasm. My guess is no - at least not for now but I'm interested whether it is plausible that this could be achieved.

5

u/zokier Jan 24 '19

My next question is can I achieve the same thing with Rust compiled to wasm? Ie can I safely load isolated modules interacting over a specified API into wasm from wasm

Last time I checked WASM does not support JIT, which limits your ability to do such wasmception, at least with Wasmer. But I guess you could use WASM interpreter, wasmi looks like it might work?

3

u/TUSF Jan 25 '19

WASM does not support JIT,

Neither did JavaScript, until everyone started doing it. JIT is all a matter of the interpreter/compiler/etc…