tuple!() { /* proc-macro */ }Expand description
Generate a tuple from a list of expressions.
§Syntax
tuple!( [ Expr1 [; Count], Expr2 [; Count], ... ] )
The [ and ] markers only indicate optional content but not that the [ and ] need to be input.
Similarly, ... indicates several repeated segments, rather than inputing ....
§Examples
use tuplez::*;
let tup = tuple!(1, "hello", 3.14);
let tup2 = tuple!("world", 2;3, 9.8); // Repeat `2` three times
assert_eq!(tup2, tuple!("world", 2, 2, 2, 9.8));
let unit = tuple!();
assert_eq!(unit, Unit);Remember that macros do not directly evaluate expressions, so:
use tuplez::*;
let mut x = 0;
assert_eq!(tuple!({x += 1; x}; 3), tuple!(1, 2, 3));