mirror of
https://github.com/ahgamut/rust-ape-example.git
synced 2024-05-29 00:38:05 +00:00
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();
|
||
|
}
|
||
|
|