2.3 Linux

2.3.1 Get R

Get R > 3.3.0.

2.3.2 Get Rust

curl -sSf https://static.rust-lang.org/rustup.sh | sh

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 binary.

2.3.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('
// #[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)