I've asked sometimes here, but I want more feedback on an idea.
I'm aware of the wasm2swf tool which converts WebAssembly to ActionScript bytecode and SWF, possibly allowing to use Rust instead of ActionScript.
I'll need more than wasm2swf. I don't want to use the Loader class too as the wasm2swf example uses to invoke Rust code. Since the goal is to reuse the ActionScript API, I think I could remove std as dependency. Is it possible to depend on nothing from Rust's built-ins (std, etc.)?
For example, I want to use the ActionScript String type. I want it with Copy + PartialEq and more traits. How would I go on properly allowing Rust to interoperate with the Adobe AIR ecosystem?
Another question: Is it possible for the string literal ("string", aka. &'static str) to return, say, actionscript::global::String? I suppose it involves using extern something.
I just wanted this to work:
use actionscript::global::*;
let s: String = "some str";
// rather than
let s: &'static str = "some str";
Is String::from("some str") all I can do? (And s.into() where possible)
let s = String::from("abc");
// inference = use .into
fn f(s: String) {
// procedure
}
f("abc".into());
I still didn't want to use wasm2swf nor did I want to convert myself the rustc's generated .wasm to SWF. I think that Rust compiled to WebAssembly "loses" all information, such as what's the type of a variable.
I think that both the LLVM bitcode or IR and WebAssembly outputs of Rust aren't ideal, because they generated low-level code. I need to compile Rust to a high-level format that I can easily compile to AVM2 bytecode.
I could use the Rust compiler API for achieving what I want, but then I'll lose all of the existing IDE support (including rust-analyzer)?
Is there a way to build a Rust or Cargo project to a kind of high-level bytecode?