Skip to main content

named_args

Macro named_args 

Source
macro_rules! named_args {
    () => { ... };
    ($($name:ident : $val:expr),+ $(,)?) => { ... };
}
Expand description

Build a kernel argument tuple from named fields.

Names are stripped at compile time; the result is identical to a plain positional tuple with zero runtime or size overhead.

§Syntax

named_args!(name1: value1, name2: value2, ...)

§Returns

A tuple (value1, value2, ...) with the same types as the values.

§Examples

use oxicuda_launch::named_args;

let n: u32 = 1024;
let alpha: f32 = 2.0;

// Named form — more readable, identical output to positional.
let named = named_args!(n: n, alpha: alpha);
// Positional form — for comparison.
let positional = (n, alpha);

assert_eq!(named, positional);