Type: Package
Title: Minimal Examples of Using Rust Code in R
Version: 1.2.3
Description: Template R package with minimal setup to use Rust code in R without hacks or frameworks. Includes basic examples of importing cargo dependencies, spawning threads and passing numbers or strings from Rust to R. Cargo crates are automatically 'vendored' in the R source package to support offline installation. The GitHub repository for this package has more details and also explains how to set up CI. This project was first presented at 'Erum2018' to showcase R-Rust integration https://jeroen.github.io/erum2018/; for a real world use-case, see the 'gifski' package on 'CRAN'.
License: MIT + file LICENSE
URL: https://github.com/r-rust/hellorust
BugReports: https://github.com/r-rust/hellorust/issues
SystemRequirements: Cargo (Rust's package manager), rustc
Encoding: UTF-8
RoxygenNote: 7.2.1
NeedsCompilation: yes
Packaged: 2025-03-17 21:13:16 UTC; jeroen
Author: Jeroen Ooms ORCID iD [aut, cre], Authors of the dependency Rust crates [aut] (see AUTHORS file)
Maintainer: Jeroen Ooms <jeroenooms@gmail.com>
Repository: CRAN
Date/Publication: 2025-03-17 21:30:02 UTC

Hello Rust!

Description

Minimal examples of calling rust functions in R via C.

Usage

hello()

random()

runthreads()

Details

These functions call out to rust functions defined in the 'myrustlib' cargo crate which is embedded in this package. They return values generated in Rust, such as a UTF-8 string or random number. In addition, 'runthreads' is an example of a multi-threaded rust function.

Value

a value generated in Rust (a string, random number, and NULL respectively).

Examples

hello()
random()
runthreads()