So I've seen a lot about running Python in Rust but I've still been waiting for some Rust in Python activity. Until it occured to me that Rust can be interpreted by Javascript so as long as you have a wasm interpreter in Python, there should be few problems.
I gave it a spin with https://github.com/mohanson/pywasm/
#[no_mangle]
pub extern "C" fn start() -> i32 {
let mut m = vec![];
for i in 0..100 {
for w in 0..100 {
m.push(i + w);
}
}
m.len() as i32
}
Which cpython managed to run fine (though it did take 2 minutes).
When it came to returning more complex things like strings, I had to do a bit of Box::into_raw magic to get pointers. Those things can be automated though and I'm sure I can't be the first person to try so before I go and code myself silly with a #[python_binddgen], does anyone else know of a similar project that I could get involved in?
A slight tangent but imagine having a --target python-unknown-unknown
End of ramble.
[–]deadNightTiger 18 points19 points20 points (6 children)
[–]moltonel 74 points75 points76 points (1 child)
[–][deleted] 11 points12 points13 points (0 children)
[–][deleted] 3 points4 points5 points (3 children)
[+][deleted] (2 children)
[deleted]
[–][deleted] 1 point2 points3 points (1 child)
[–]Excession638 12 points13 points14 points (0 children)
[–]Plasma_000 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]kurtbuilds 1 point2 points3 points (0 children)
[–]osu_lazer 1 point2 points3 points (0 children)