Skip to content

Instantly share code, notes, and snippets.

@rbuckland
Created September 15, 2018 06:59
Show Gist options
  • Save rbuckland/b291db20b0a869e5c8c23e5a7a2ed2a9 to your computer and use it in GitHub Desktop.
Save rbuckland/b291db20b0a869e5c8c23e5a7a2ed2a9 to your computer and use it in GitHub Desktop.
My Rust Snippets
// https://stackoverflow.com/questions/25576748/how-to-compare-enum-without-pattern-matching
macro_rules! matches(
($e:expr, $p:pat) => (
match $e {
$p => true,
_ => false
}
)
);
... filter(|f| matches!(f, Some::Enum)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment