expression
Width, fill and alignment
Width is a minimum, not a maximum. Alignment and fill control how a representation shorter than the requested width is padded. Expected stdout (not executed): | ab| |**cat**| |long| Common mistake: Using width to truncate a long string.
Formal Syntax & Structure
rust syntaxrust
{:>8}; {:*^7}; {:<8}Working Example
Example Snippetrust
fn main() { println!("|{:>5}| |{:*^7}|", "ab", "cat"); println!("|{:2}|", "long");}