This function finds and runs Cargo (Rust's package manager) with the
...
arguments passed as command line arguments but, by default, runs
according to CRAN policies. First, it does not write to the user's file
system (e.g., ~/.cargo
). Second, it only uses at most two parallel
jobs.
run(..., minimum_version = file.path("..", "DESCRIPTION"), verbose = TRUE)
Character vector of command line arguments passed to the
cargo
command.
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)
.
Should Cargo be run in non-quiet mode?
A logical equaling TRUE
if and only if the minimum version is
available and the exit status of the command is zero (indicating success).
The function is designed to never throw a warning or error.
To enable caching, set the R_CARGO_SAVE_CACHE
environment variable to
TRUE
. Then, if defined, the R_CARGO_HOME
environment variable
will be used as the cache location. Otherwise, Cargo uses its default
behavior (usually writing to ~/.cargo
unless the CARGO_HOME
environment variable is set). Regardless of the location, the user is
responsible to maintaining and clearing the cache when using the
R_CARGO_SAVE_CACHE
environment variable.
To enable a specific number of parallel jobs, set the
R_CARGO_BUILD_JOBS
environment variable to the desired integer. If
R_CARGO_BUILD_JOBS
is 0
, Cargo will use its default behavior
(usually using all the cores unless the CARGO_BUILD_JOBS
environment
variable is set or the --jobs
argument is provided).
# NOT RUN {
run(minimum_version="1.54")
# }
Run the code above in your browser using DataLab