We've seen that formatting is specified via a format string:
format!("{}", foo) -> "3735928559"format!("0x{:X}", foo) ->
"0xDEADBEEF"format!("0o{:o}", foo) -> "0o33653337357"The same variable (foo) can be formatted differently depending on which
argument type is used: X vs o vs unspecified.
This formatting functionality is implemented via traits, and there is one trait
for each argument type. The most common formatting trait is Show, which
handles cases where the argument type is left unspecified: {} for instance.
Here's the full list of formatting traits and their respective argument types:
Showd and i -> Signedu -> Unsignedb -> Boolc -> Charo -> Octalx -> LowerHexX -> UpperHexs -> Stringp -> Pointert -> Binaryf -> Floate -> LowerExpE -> UpperExp? -> Poly