mirror of
https://github.com/ahgamut/rust-ape-example.git
synced 2024-05-15 10:02:42 +00:00
d976dc883b
via panflute and https://github.com/rust-lang/rust-by-example
22 lines
380 B
Rust
22 lines
380 B
Rust
// ./src/macros.md
|
|
|
|
|
|
// This is a simple macro named `say_hello`.
|
|
macro_rules! say_hello {
|
|
// `()` indicates that the macro takes no argument.
|
|
() => {
|
|
// The macro will expand into the contents of this block.
|
|
println!("Hello!");
|
|
};
|
|
}
|
|
|
|
fn part0() {
|
|
// This call will expand into `println!("Hello");`
|
|
say_hello!()
|
|
}
|
|
|
|
pub fn main() {
|
|
part0();
|
|
}
|
|
|