Rust macros and functions

Rust functions

Macros

macros end in "!" eg println!

macro_rules! say_hello {
    // `()` indicates that the macro takes no argument.
    () => {
        // The macro will expand into the contents of this block.
        println!("Hello!");
    };
}

fn main() {
    // This call will expand into `println!("Hello");`
    say_hello!()
}

Functions

fn main() {}
fn my_function(x: i32) -> i32 {}