extendr_api

Macro lang

Source
macro_rules! lang {
    ($sym : expr) => { ... };
    ($sym : expr, $($rest: tt)*) => { ... };
}
Expand description

A macro for constructing R language objects.

Example:

use extendr_api::prelude::*;
test! {
    let call_to_c = lang!("c", 1., 2., 3.);
    let vec = call_to_c.eval().unwrap();
    assert_eq!(vec, r!([1., 2., 3.]));

    let list = lang!("list", a=1, b=2).eval().unwrap();
    assert_eq!(list.len(), 2);
}