2.1 Windows

2.1.1 Get R

Get R > 3.3.0 builded by GCC 4.9 and Rtools > 3.3

2.1.2 Get Rust with GNU ABI

Checkout https://www.rust-lang.org/downloads.html

One of stable, beta, or nightly version of Rust is OK. You can put Rust installation in PATH or set CARGO_HOME environment variable to the path of cargo.exe.

If you want to build multi-arch R package, make sure you install both 64bit and 32bit Rust standard library, for example C:\Rust\lib\rustlib\i686-pc-windows-gnu and C:\Rust\lib\rustlib\x86_64-pc-windows-gnu

2.1.3 Get rustinr

Run This in R:

install.packages("devtools")
devtools::install_github("rustr/rustinr")

And we are ready to play!

Run this in R console.

library(rustinr)

rust(code ='
// #[rustr_export]
pub fn say_hi() -> String{
    "Hello World".into()
}
')

say_hi()
#> [1] "Hello World"

If some errors show up, run rustr_check to get more info:

rustr_check(detail = T)