[−][src]Macro tuples::tuple
Convenient shorthand
Syntax
tuple![<type>; <repeat times>]
tuple![<expr>; <repeat times>]
tuple![<tuple size>; <type>, <type> ...]
Examples
Repeat type
let a: tuple![u8; 3] = (5, 5, 5);
Repeat expr
let a: (u8, u8, u8) = tuple![5; 3];
Auto types
let a: tuple![3; u8] = (5, 5, 5usize); let b: (u8, i32, usize) = tuple![5; 3]; assert_eq!(a, b);
Iter
let a = (1, 2, 3) .into_iter() .map(|v| v * 3) .collect_tuple::<tuple![3;]>(); let b: (i32, i32, i32) = (3, 6, 9); assert_eq!(a, b);
ⓘThis example is not tested
tuple![u8; 3] => (u8, u8, u8) tuple![5; 3] => (5, 5, 5) tuple![3; u8, u8, u8] => (u8, u8, u8) tuple![3; u8] => (u8, _, _) tuple![3;] => (_, _, _)