Skip to content

Instantly share code, notes, and snippets.

@JarrettBillingsley
Created December 16, 2013 10:41
Show Gist options
  • Save JarrettBillingsley/7985135 to your computer and use it in GitHub Desktop.
Save JarrettBillingsley/7985135 to your computer and use it in GitHub Desktop.
macro_rules! vertex_format_inner
(
(($a: expr, $b: expr), $(($a_rest: expr, $b_rest: expr)),+) =>
(
($a, $b), vertex_format_inner!($(($a_rest, $b_rest)),*)
);
(($a: expr, $b: expr)) =>
(
($a, $b)
)
)
macro_rules! vertex_format
(
($(($a: expr, $b: expr)),+) =>
(
~[vertex_format_inner!($(($a, $b)),+)]
)
)
fn main()
{
vertex_format!(
(1, 2), (3, 4)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment