pass_multiple_doubles: Multiplies a double vector by 10 in Rust

Description Usage Arguments Details Value Examples

View source: R/extendr-wrappers.R

Description

Demonstrates passing a double vector back and forth between R and Rust, multiplies each element by 10 in Rust to prove it works.

Usage

1

Arguments

f

A double (float) vector to treat as an extendr_api::Real in Rust

Details

The vector passed to this function must be a double vector (default numeric vector type in R) or an NA_real_. The Rust function signature is fn pass_multiple_doubles_fn(f: Real) -> Real. NA's, NaN's, Inf's, and -Inf's are handled implicitly by the f64 specification.

Value

f * 10

Examples

1
pass_multiple_doubles(c(5.55, NA, NaN, Inf, -Inf))  # c(55.5, NA, NaN, Inf, -Inf)

ericwburden/rustbind documentation built on April 10, 2021, 12:31 p.m.