The syntax is like the str.format syntax in Python. This:
fn main() {
println!(
"{0: <10} | {1: <10} | {2: <10} | {3: <10}",
"total", "blanks", "comments", "code"
);
println!("{0: <10} | {1: <10} | {2: <10} | {3: <10}", 0, 0, 0, 0);
println!("{0: <10} | {1: <10} | {2: <10} | {3: <10}", 77, 0, 3, 74);
println!("{0: <10} | {1: <10} | {2: <10} | {3: <10}", 112, 0, 6, 106);
println!(
"{0: <10} | {1: <10} | {2: <10} | {3: <10}",
460, 0, 10, 1371
);
}
(playground)
produces the following output:
total | blanks | comments | code
0 | 0 | 0 | 0
77 | 0 | 3 | 74
112 | 0 | 6 | 106
460 | 0 | 10 | 1371