Created
January 31, 2017 17:08
-
-
Save killercup/79183df0a0cf19879c21ac62b3f0a2c2 to your computer and use it in GitHub Desktop.
This file contains 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
macro_rules! externs { | |
( $name:ident with macros, $($rest:tt)* ) => { | |
externs!($x with macros); | |
externs!($($rest)*); | |
}; | |
( $name:ident, $($rest:tt)* ) => { | |
externs!($name); | |
externs!($($rest)*); | |
}; | |
( $name:ident with macros ) => { | |
#[macro_use] extern crate $name; | |
}; | |
( $name:ident ) => { | |
extern crate $name; | |
}; | |
() => {} | |
} | |
externs![rocket, rocket_contrib, serde_json with macros]; | |
// other test cases: | |
// externs!{ serde_json with macros } | |
// externs!{ rocket, rocket_contrib, } | |
// externs!{ rocket } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment