diff options
Diffstat (limited to 'macros/macros2.rs')
| -rw-r--r-- | macros/macros2.rs | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/macros/macros2.rs b/macros/macros2.rs new file mode 100644 index 0000000..040dc7f --- /dev/null +++ b/macros/macros2.rs @@ -0,0 +1,72 @@ +// Make me compile! Scroll down for hints :) + +fn main() { + my_macro!(); +} + +macro_rules! my_macro { + () => { + println!("Check out my macro!"); + }; +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// Macros don't quite play by the same rules as the rest of Rust, in terms of what's available +// where. + + + + + + + + +// Unlike other things in Rust, the order of "where you define a macro" versus "where you use it" +// actually matters. |
