R/rextendr_document.R

Defines functions document

Documented in document

#' Compile Rust code and generate package documentation.
#'
#' The function `rextendr::document()` updates the package documentation for an
#' R package that uses `extendr` code, taking into account any changes that were
#' made in the Rust code. It is a wrapper for [devtools::document()], and it
#' executes `extendr`-specific routines before calling [devtools::document()].
#' Specifically, it ensures that Rust code is recompiled (when necessary) and that
#' up-to-date R wrappers are generated before re-generating the package documentation.
#' @inheritParams devtools::document
#' @return No return value, called for side effects.
#' @export
document <- function(pkg = ".", quiet = getOption("usethis.quiet", FALSE), roclets = NULL) {
  try_save_all(quiet = quiet)

  register_extendr(path = pkg, quiet = quiet)

  rlang::check_installed("devtools")
  devtools::document(pkg = pkg, roclets = roclets, quiet = FALSE)
}

Try the rextendr package in your browser

Any scripts or data that you put into this service are public.

rextendr documentation built on June 15, 2021, 5:06 p.m.