Skip to main content

Module dots

Module dots 

Source
Expand description

Support for R ... arguments represented as a validated list. R’s ... (variadic arguments) support.

Provides Dots, the Rust representation of R’s ... parameter. The generated R wrapper captures ... as list(...) and passes it to Rust.

§Usage

Use ... as the parameter type — the macro handles the rest:

#[miniextendr]
pub fn greet(prefix: &str, dots: ...) {
    let list = dots.as_list();
    // Access by name: list.get_named::<String>("key")
    // Access by position: list.get_index::<i32>(0)
}

Use name @ ... syntax for a custom parameter name, or combine with typed_list! for structure validation:

#[miniextendr(dots = typed_list!(x: i32, y: f64))]
pub fn validated(args: ...) {
    // dots_typed.x and dots_typed.y are available
}

Structs§

Dots
Rust type representing R’s ... (variadic arguments).