Analogous to usethis::use_package() but for crate dependencies.
use_crate(
crate,
features = NULL,
git = NULL,
version = NULL,
optional = FALSE,
path = ".",
echo = TRUE
)character scalar, the name of the crate to add
character vector, a list of features to include from the crate
character scalar, the full URL of the remote Git repository
character scalar, the version of the crate to add
boolean scalar, whether to mark the dependency as optional (FALSE by default)
character scalar, the package directory
logical scalar, should cargo command and outputs be printed to console (default is TRUE)
NULL (invisibly)
For more details regarding these and other options, see the
Cargo docs
for cargo-add.
if (FALSE) { # \dontrun{
# add to [dependencies]
use_crate("serde")
# add to [dependencies] and [features]
use_crate("serde", features = "derive")
# add to [dependencies] using github repository as source
use_crate("serde", git = "https://github.com/serde-rs/serde")
# add to [dependencies] with specific version
use_crate("serde", version = "1.0.1")
# add to [dependencies] with optional compilation
use_crate("serde", optional = TRUE)
} # }