Answer the question
In order to leave comments, you need to log in
What is the best way to change the code generated by wasm-bindgen?
I am writing an application on electron.js, I needed a library in it written in rust in the form of a wasm module. Already wrote a wrapper for it using the wasm-bindgen crate. But I ran into a problem that not one of the js bindings generated by wasm-bindgen suits me. I need the wasm module to be cached in memory, and obtained from a variable in the main process and via electron's virtual protocol in render processes.
I have already abandoned the idea of forking wasm-bindgen and adding my own template for binding, because I will have to fork several crates at once ...
For now, I am looking towards parsing the generated code into the AST tree and editing the wasm module loading code. Fortunately, this part of the code is quite the same type and, according to my observations, does not change from changing the rust code.
But maybe there is an easier solution?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question