Macro jlrs::named_tuple

source ·
macro_rules! named_tuple {
    ($frame:expr, $name:expr => $value:expr) => { ... };
    ($frame:expr, $name:expr => $value:expr, $($rest:tt)+) => { ... };
    ($frame:expr, $i:expr, $pairs:expr, $name:expr => $value:expr, $($rest:tt)+) => { ... };
    ($frame:expr, $i:expr, $pairs:expr, $name:expr => $value:expr) => { ... };
}
Expand description

Create a new named tuple. You will need a named tuple to call functions with keyword arguments.

Example:

// Three slots; two for the inputs and one for the output.
julia.scope(|mut frame| {
    // Create the two arguments, each value requires one slot
    let i = Value::new(&mut frame, 2u64);
    let j = Value::new(&mut frame, 1u32);

    let _nt = named_tuple!(&mut frame, "i" => i, "j" => j);

    Ok(())
}).unwrap();