3 ms·
The compilation target could be a Rust slab [0], much like Emscripten uses Typed Arrays [1]. In doing so, it would retain much of the safety properties of Rust,
by sitkack 8y ago
The compilation target could be a Rust slab [0], much like Emscripten uses Typed Arrays [1]. In doing so, it would retain much of the safety properties of Rust, but it pushes the problem into maintaining "the heap" for the C code.
[0] https://github.com/carllerche/slab https://github.com/carllerche/slab
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays https://developer.mozilla.org/en-US/docs/Web/JavaScript/Type...
- masklinn 8y agoThat would be significantly less useful if the intent is to move the code from C to Rust.
- sitkack 8y agoHow so? It allows unsafe C to be incorporated into safe Rust while maintaining the same level of safety. A similar less ergonomic solution would be to load C via WASM modules. I'd take slab or wasm over whole lib translation into unsafe Rust.