Printing
print!
and println!
macros to write to stdout. There is also format!
to write to a string.
Simple types can be printed with display formatting {}
. More complex types can be printed with debug formatting {:?}
.
Display formatting requires implementing std::fmt::Display
.
{:#?}
is pretty-printing.
Named substitution
Substitution format
{variable:padding alignment minimum.maximum}
e.g. {city1:0<5.15}