Skip to content

Instantly share code, notes, and snippets.

@flo-l
Created May 22, 2015 11:08
Show Gist options
  • Save flo-l/e373dfb7664e0e98a238 to your computer and use it in GitHub Desktop.
Save flo-l/e373dfb7664e0e98a238 to your computer and use it in GitHub Desktop.
macro_rules! construct_tuple {
(0,$it:expr) => ();
($n:expr, $e:expr) => (
$e,construct_tuple!($n-1,$e)
);
}
#[test]
fn construct_tuple() {
let t = (construct_tuple!(2,1u8),);
assert_eq!(t,(1,1));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment