Two knitr engines that enable code chunks of type extendr (individual Rust
statements to be evaluated via rust_eval()) and extendrsrc (Rust functions
or classes that will be exported to R via rust_source()).
Details
Both engines support the following chunk options:
preamble: A character vector of chunk labels. The code from those chunks is placed before the current chunk's code, in the order given, and the combined code is compiled as a single unit. Only the current chunk's code is shown in the output. This is useful for splitting Rust code across several chunks, for example defining helper functions in one chunk (typically witheval = FALSE) and calling them in another. Unlike knitr'sref.labeloption, which shows the reused code in the rendered document,preambleadds the code to the compile unit without displaying it. Seevignette("rmarkdown", package = "rextendr")for an example.engine.opts: A list of arguments passed torust_eval()(forextendr) orrust_source()(forextendrsrc), e.g.engine.opts = list(dependencies = list(rand = "0.8")). Theenvargument defaults toknitr::knit_global().eval: IfFALSE, the code is displayed but not compiled.error: IfTRUE, a compilation error is shown in the document instead of stopping the render.