Description Usage Arguments Details Value Examples
View source: R/extendr-wrappers.R
Demonstrates passing a raw (byte) value back and forth between R and Rust, left shifting the value in Rust to prove it works.
1 |
r |
A raw value to treat as a byte in Rust |
The value passed to this function must be a raw, the byte type in R. The
Rust function signature is fn pass_single_raw_fn(r: u8) -> u8
. R does
not support NAs for raw types. Currently, extendr (v0.2.0) supports passing
in numbers from 0-255 instead of values from as.raw()
as single values.
Values below 0 are coerced to 0, values greater than 255 are coerced to
255.
bitwShiftL(r, 1)
1 2 3 | pass_single_raw(4) # 8
pass_single_raw(-10) # 0
pass_single_raw(300) # 254
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.