extendr_api::prelude

Macro extendr_module

Source
extendr_module!() { /* proc-macro */ }
Expand description

Define a module and export symbols to R Example:

 extendr_module! {
     mod name;
     fn my_func1;
     fn my_func2;
     impl MyTrait;
 }

Outputs:

#[no_mangle]
#[allow(non_snake_case)]
pub extern "C" fn R_init_hello_extendr(info: *mut extendr_api::DllInfo) {
    let mut call_methods = Vec::new();
    init__hello(info, &mut call_methods);
    unsafe { extendr_api::register_call_methods(info, call_methods.as_ref()) };
}