Re: Allow access to node's Buffer class
I'm working on getting Screeps to work with Rust's wasm-bindgen
(the official way to run Rust in Node.js). The only thing blocking this is that the Rust/JS shim makes use of TextDecoder
for performance. This API has existing in Node since Node 8 (screeps uses Node 10) and is also supported in most major browsers, so it would also work with the simulator.
In fact, TextDecoder
is already available in the simulator at global scope, so Rust already works there. We just need TextDecoder
to also be there when running in Node.
Previous discussions mentioned allowing access to Node's Buffer
class, but that's no longer necessary as the Rust Shims now just use TextDecoder
and Uint8Array
.
This came up because the toolchain that the existing Rust API uses (stdweb
) is no longer maintained, and the wasm-bindgen
alternative is officially supported by the Rust org.