...
1fn main() {
2 let foo = 'x';
3
4 println!(
5 "
6 Kitchen sink
7 {{ }} - Escaped
8 {{{}}} - Escaped with inner interpol
9 {foo:#?} - Ident with pretty debug format
10 {0:-<5} - Positional with complex fill/alignment
11 ",
12 foo,
13 );
14
15 // Unconventional formatting
16 println! ( "Hello, {foo}!");
17
18 // Exhausting the supported macros
19 eprintln!("{foo}");
20 eprint!("{foo}");
21 println!("{foo}");
22 print!("{foo}");
23 format!("{foo}");
24 format_args!("{foo}");
25 panic!("{foo}");
26 todo!("{foo}");
27 unreachable!("{foo}");
28 unimplemented!("{foo}");
29}
View as plain text