extendr / rextendr

An R package that helps scaffolding extendr-enabled packages or compiling Rust code dynamically
https://extendr.github.io/rextendr/
Other
181 stars 27 forks source link

Add `use_dev_extendr` option #251

Closed Ilia-Kosenkov closed 1 year ago

Ilia-Kosenkov commented 1 year ago

Add new flag use_dev_extendr to rust_source() function. If extendr_deps is NULL (i.e. not specified by the user), populates extendr_deps from options, using rextendr.extendr_deps if use_dev_extendr is not TRUE, otherwise, uses rextendr.extendr_dev_deps.

In turn, rextnedr.extendr_dev_deps by default is set to list(`extendr-api` = list(git = "https://github.com/extendr/extendr")).

This allows testing short code snippets against dev extendr with just one extra arg, e.g.

rust_function("fn new_awesome_features_test() {}", use_dev_extendr = TRUE)

or, while either is not available on crates.io,

rust_function(
  "fn uses_either() -> either::Either<Rint, Rfloat> { either::Either::Left(Rint::default()) }",
  use_dev_extendr = TRUE, 
  features = "either",
  dependencies = list(either = "*")
)

Closes #250