October 2019
Intermediate to advanced
444 pages
10h 37m
English
Let's implement some overloaded macros in a few simple steps:
#![allow(unused_macros)]macro_rules! print_debug { (stdout, $($o:expr),*) => { $(print!("{:?}", $o));*; println!(); }; (error, $($o:expr),*) => { $(eprint!("{:?}", $o));*; eprintln!(); }; ($stream:expr, $($o:expr),*) => { $(let _ = write!($stream, "{:?}", $o));*; let _ = writeln!($stream); }}
Read now
Unlock full access