Created
September 15, 2018 06:59
-
-
Save rbuckland/b291db20b0a869e5c8c23e5a7a2ed2a9 to your computer and use it in GitHub Desktop.
My Rust Snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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