Skip to content

Instantly share code, notes, and snippets.

@Kimundi
Last active December 22, 2015 00:59
Show Gist options
  • Select an option

  • Save Kimundi/6393248 to your computer and use it in GitHub Desktop.

Select an option

Save Kimundi/6393248 to your computer and use it in GitHub Desktop.
macro_rules! matches (
($e:expr, $($p:pat)|+) => (
match &$e {
$(&$p)|+ => true,
_ => false
}
);
($e:expr, $($p:pat)|+ if $g:expr) => (
match &$e {
$(&$p)|+ if $g=> true,
_ => false
}
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment