Skip to content

Essential Macros

Unlike other programming languages, macros aren't frowned upon in Rust, in fact they are often the clearest way (and sometimes the only way) to access many standard library implementations.

vec!

Create a vector

rust
let number_list = vec![5, 10, 20, 40, 80];
let number_list = vec![5, 10, 20, 40, 80];

println!

Print to Stdout using format specifiers

rust
println!("Your list is {:?}", number_list);
println!("Your list is {:?}", number_list);

Add log::info! macros...