Feature Request - add Rust to EmbedCode and ExternalEvaluate

Greetings to all,

Not sure if this is the space to create feature requests, but I figured I’d give it a try.

For my security and low-level device work, it wasn’t until the 11.3 version of the Wolfram Language that it became a viable stack.

Stephen and Co. have managed to cover with WL a great deal of situations and platforms. What I’d like to see now is extend that functionality further by including support for Rust and bring it up to par with other already included environments. Rust’s light footprint, security emphasis and the fact that it doesn’t require a runtime - let’s not forget it’s also super fast - make for a great addition.

$EmbeddedCodeEnvironments

{Android, C#, C++,VisualStudio, GoogleDocs, HTML, Java, Java-Jersey, Javascript, Perl, PHP, Python, Ruby, Scalia, VisualBasic}

I mean, look at the cool stuff one can do with EmbedCode

With ExternalEvaulate I could use WL to develop and create Rust/WL functions that run on AWS Lambda and small micro controller platforms. A match made in heaven. Did I mention WebAssembly?

This type of functionality would be worth the price of a license all by itself. Just asking!

Thanks,
Jose

Feature requests should be submitted to:

The best way to do this is to create a Rust library with external functions and then use the Foreign Function Interface to load and execute these functions:

For example if you have this Rust code (add.rs):

use std::os::raw::{c_int};

#[no_mangle]
pub extern "C" fn add(a: c_int, b: c_int) -> c_int {
    a + b
}

And build it with Cargo, then you will get an add.dylib library, which you can load in Wolfram Language:

add = ForeignFunctionLoad[ "add.dylib", "add", {"Integer64", "Integer64"} -> "Integer64"]

Now you can call this function from the Wolfram Language:

add[4,5]

Hope that helps.

You can download the Rust code (plus Cargo.toml file) from here:

https://amoeba.wolfram.com/index.php/s/ykm3H72tRbtfxBr