Description Usage Arguments Details Value Examples
View source: R/extendr-wrappers.R
Demonstrates passing an integer back and forth between R and Rust, multiplies the given integer by 10 in Rust to prove it works.
1 |
n |
An integer value to treat as an i32 in Rust |
The value passed to this fuction must be an integer (from as.integer(n)) or
an NA_integer_. The Rust function signature is
fn pass_single_integer(n: Option<i32>) -> Option<i32>
, with NA's being
handled as None
in Rust. The native R integer is also a signed 32-bit
integer, which is equivalent to Rust's i32
.
n * 10
1 2 | pass_single_integer(as.integer(25)) # 250
pass_single_integer(NA_integer_) # NA_integer_
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.