This function takes Rust code as a string from the last unnamed argument, takes variable names for all other unnamed arguments, compiles the Rust function, and wraps it as an R function.
rust_fn(
...,
dependencies = character(0),
minimum_version = "1.31.0",
verbose = FALSE,
cached = TRUE,
longjmp = TRUE,
invisible = FALSE
)
Rust code is taken as a string from the last unnamed argument, and variable names come for all other unnamed arguments. See example.
A character vector of crate dependencies, e.g.,
c('rand = "0.8.4"','rand_pcg = "0.3.1"')
.
A character string representing the minimum version of
Rust that is needed. Or a path to the DESCRIPTION file, in which case the
value is found from the field: SystemRequirements: Cargo (>= XXXX)
.
If TRUE
, Cargo prints compilation details. If
FALSE
, Cargo is run in quiet mode, except for the first time this
function is run. If "never"
, Cargo is always run in quiet mode.
In any case, errors in code are always shown.
Should Cargo use previously compiled artifacts?
Should the compiled function use the faster (but experimental) longjmp functionality when Rust code panics?
Should the compiled function return values invisibly?